Files
sam-manage/app/Models/Interview/InterviewCategory.php

58 lines
1.2 KiB
PHP
Raw Permalink Normal View History

<?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');
}
}