38 lines
777 B
PHP
38 lines
777 B
PHP
<?php
|
|
|
|
namespace Modules\Employee\Models;
|
|
|
|
use App\Models\User;
|
|
use App\Traits\CreatedUpdatedBy;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Modules\Employee\Database\Factories\DepartmentFactory;
|
|
|
|
class Department extends Model
|
|
{
|
|
use HasFactory, CreatedUpdatedBy;
|
|
|
|
/**
|
|
* The attributes that are mass assignable.
|
|
*/
|
|
protected $fillable = [
|
|
'title',
|
|
'slug',
|
|
'status',
|
|
'order',
|
|
'user_id',
|
|
'createdby',
|
|
'updatedby',
|
|
];
|
|
|
|
public function departmentHead()
|
|
{
|
|
return $this->belongsTo(User::class, 'user_id');
|
|
}
|
|
|
|
protected static function newFactory(): DepartmentFactory
|
|
{
|
|
return DepartmentFactory::new();
|
|
}
|
|
}
|