- InterviewCategory 모델에 parent/children 관계 추가 - Service: getTree, getProjectTree 루트+children eager loading - Service: createCategory에 parent_id 지원 - Service: cloneMaster 2단계 계층 복제 - Controller: storeCategory validation에 parent_id 추가 - UI: CategorySidebar/DomainSidebar 트리 뷰 렌더링 - UI: findCategory 헬퍼로 트리 내 카테고리 검색
58 lines
1.2 KiB
PHP
58 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace App\Models\Interview;
|
|
|
|
use App\Traits\BelongsToTenant;
|
|
use App\Traits\ModelTrait;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
|
|
|
class InterviewCategory extends Model
|
|
{
|
|
use BelongsToTenant, ModelTrait, SoftDeletes;
|
|
|
|
protected $fillable = [
|
|
'tenant_id',
|
|
'interview_project_id',
|
|
'parent_id',
|
|
'name',
|
|
'description',
|
|
'domain',
|
|
'sort_order',
|
|
'is_active',
|
|
'created_by',
|
|
'updated_by',
|
|
'deleted_by',
|
|
];
|
|
|
|
protected $casts = [
|
|
'is_active' => 'boolean',
|
|
'sort_order' => 'integer',
|
|
];
|
|
|
|
public function parent()
|
|
{
|
|
return $this->belongsTo(self::class, 'parent_id');
|
|
}
|
|
|
|
public function children()
|
|
{
|
|
return $this->hasMany(self::class, 'parent_id')->orderBy('sort_order');
|
|
}
|
|
|
|
public function project()
|
|
{
|
|
return $this->belongsTo(InterviewProject::class, 'interview_project_id');
|
|
}
|
|
|
|
public function templates()
|
|
{
|
|
return $this->hasMany(InterviewTemplate::class, 'interview_category_id');
|
|
}
|
|
|
|
public function sessions()
|
|
{
|
|
return $this->hasMany(InterviewSession::class, 'interview_category_id');
|
|
}
|
|
}
|