Files
new_raffles/Modules/PMS/app/Models/Project.php
2025-07-27 17:40:56 +05:45

43 lines
1.1 KiB
PHP

<?php
namespace Modules\PMS\Models;
use App\Traits\CreatedUpdatedBy;
use App\Traits\StatusTrait;
use Illuminate\Database\Eloquent\Model;
use Modules\Admin\Models\Department;
use Modules\Employee\Models\Employee;
class Project extends Model
{
use StatusTrait, CreatedUpdatedBy;
use \Staudenmeir\EloquentJsonRelations\HasJsonRelationships;
protected $table = 'tbl_projects';
protected $fillable = ['project_code', 'project_name', 'client_id', 'department_id', 'project_category_id', 'members_id', 'start_date', 'end_date', 'summary', 'key_notes', 'status', 'createdBy', 'updatedBy'];
protected $appends = ['status_name'];
protected $casts = [
'members_id' => 'json',
];
const CATEGORY = [
10 => 'Vue',
11 => 'Laravel',
];
public function client()
{
return $this->belongsTo(Client::class, 'client_id');
}
public function projectCategory()
{
return $this->belongsTo(ProjectCategory::class, 'project_category_id');
}
public function members()
{
return $this->belongsToJson(Employee::class, 'members_id->id');
}
}