feat : common_codes 테이블 수정

This commit is contained in:
2025-07-23 16:14:18 +09:00
parent 609ac39ffb
commit 593d81c4cb
2 changed files with 58 additions and 3 deletions

View File

@@ -8,12 +8,35 @@
class CommonCode extends Model
{
use SoftDeletes;
protected $fillable = ['tenant_id','code_group','code','name','parent_id','description','is_active','sort_order'];
public function parent() {
protected $table = 'common_codes';
protected $fillable = [
'tenant_id',
'code_group',
'code',
'name',
'parent_id',
'attributes',
'description',
'is_active',
'sort_order'
];
protected $casts = [
'attributes' => 'array',
'is_active' => 'boolean',
];
// 관계: 상위 코드
public function parent()
{
return $this->belongsTo(self::class, 'parent_id');
}
public function children() {
// 관계: 하위 코드들
public function children()
{
return $this->hasMany(self::class, 'parent_id');
}
}