fix : 테넌트별 옵션설정 작업
- Tenant Fields - Tenant Option Groups - Tenant Option Values - Tenant Profiles
This commit is contained in:
34
app/Models/Tenants/SettingFieldDef.php
Normal file
34
app/Models/Tenants/SettingFieldDef.php
Normal file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Tenants;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class SettingFieldDef extends Model
|
||||
{
|
||||
protected $casts = [
|
||||
'option_payload' => 'array',
|
||||
'is_core' => 'boolean',
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'field_key',
|
||||
'label',
|
||||
'data_type',
|
||||
'input_type',
|
||||
'option_source',
|
||||
'option_payload',
|
||||
'comment',
|
||||
'created_at',
|
||||
'updated_at',
|
||||
'storage_area',
|
||||
'storage_key',
|
||||
'is_core',
|
||||
];
|
||||
|
||||
// 관계 (테넌트 설정)
|
||||
public function tenantSettings()
|
||||
{
|
||||
return $this->hasMany(TenantFieldSetting::class, 'field_key', 'field_key');
|
||||
}
|
||||
}
|
||||
35
app/Models/Tenants/TenantFieldSetting.php
Normal file
35
app/Models/Tenants/TenantFieldSetting.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Tenants;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class TenantFieldSetting extends Model
|
||||
{
|
||||
public $timestamps = false;
|
||||
|
||||
protected $casts = [
|
||||
'enabled' => 'boolean',
|
||||
'required' => 'boolean',
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'tenant_id',
|
||||
'field_key',
|
||||
'enabled',
|
||||
'required',
|
||||
'sort_order',
|
||||
'option_group_id',
|
||||
'code_group',
|
||||
];
|
||||
|
||||
public function fieldDef()
|
||||
{
|
||||
return $this->belongsTo(SettingFieldDef::class, 'field_key', 'field_key');
|
||||
}
|
||||
|
||||
public function optionGroup()
|
||||
{
|
||||
return $this->belongsTo(TenantOptionGroup::class, 'option_group_id');
|
||||
}
|
||||
}
|
||||
22
app/Models/Tenants/TenantOptionGroup.php
Normal file
22
app/Models/Tenants/TenantOptionGroup.php
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Tenants;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class TenantOptionGroup extends Model
|
||||
{
|
||||
public $timestamps = false;
|
||||
|
||||
protected $fillable = [
|
||||
'tenant_id',
|
||||
'group_key',
|
||||
'name',
|
||||
'description',
|
||||
];
|
||||
|
||||
public function values()
|
||||
{
|
||||
return $this->hasMany(TenantOptionValue::class, 'group_id');
|
||||
}
|
||||
}
|
||||
27
app/Models/Tenants/TenantOptionValue.php
Normal file
27
app/Models/Tenants/TenantOptionValue.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Tenants;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class TenantOptionValue extends Model
|
||||
{
|
||||
public $timestamps = false;
|
||||
|
||||
protected $casts = [
|
||||
'is_active' => 'boolean',
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'group_id',
|
||||
'value_key',
|
||||
'value_label',
|
||||
'sort_order',
|
||||
'is_active',
|
||||
];
|
||||
|
||||
public function group()
|
||||
{
|
||||
return $this->belongsTo(TenantOptionGroup::class, 'group_id');
|
||||
}
|
||||
}
|
||||
42
app/Models/Tenants/TenantUserProfile.php
Normal file
42
app/Models/Tenants/TenantUserProfile.php
Normal file
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Tenants;
|
||||
|
||||
use App\Models\Members\User;
|
||||
use App\Models\Commons\Department;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class TenantUserProfile extends Model
|
||||
{
|
||||
protected $casts = [
|
||||
'json_extra' => 'array',
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'tenant_id',
|
||||
'user_id',
|
||||
'department_id',
|
||||
'position_key',
|
||||
'job_title_key',
|
||||
'work_location_key',
|
||||
'employment_type_key',
|
||||
'manager_user_id',
|
||||
'json_extra',
|
||||
'created_at',
|
||||
'updated_at',
|
||||
'profile_photo_path',
|
||||
'display_name',
|
||||
];
|
||||
|
||||
// 관계: users 테이블은 전역이라 App\Models\User 로 연결
|
||||
public function user()
|
||||
{
|
||||
return $this->belongsTo(User::class, 'user_id');
|
||||
}
|
||||
|
||||
// 조직, 직급 등은 옵션/코드 참조 가능 (필요시 추가)
|
||||
public function department()
|
||||
{
|
||||
return $this->belongsTo(Department::class, 'department_id');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user