37 lines
897 B
PHP
37 lines
897 B
PHP
|
<?php
|
||
|
|
||
|
namespace Modules\PMS\Models;
|
||
|
|
||
|
use App\Traits\CreatedUpdatedBy;
|
||
|
use App\Traits\StatusTrait;
|
||
|
use Illuminate\Database\Eloquent\Model;
|
||
|
use Modules\Employee\Models\Employee;
|
||
|
|
||
|
class Project extends Model
|
||
|
{
|
||
|
use StatusTrait, CreatedUpdatedBy;
|
||
|
|
||
|
protected $table = 'tbl_projects';
|
||
|
protected $fillable = ['project_code', 'project_name', 'client_id', 'project_category_id', 'members_id', 'start_date', 'end_date', 'summary', 'status', 'createdBy', 'updatedBy', 'created_at', 'updated_at'];
|
||
|
protected $appends = ['status_name'];
|
||
|
|
||
|
protected $casts = [
|
||
|
'members_id' => 'array',
|
||
|
];
|
||
|
const CATEGORY = [
|
||
|
10 => 'Vue',
|
||
|
11 => 'Laravel',
|
||
|
];
|
||
|
|
||
|
public function client()
|
||
|
{
|
||
|
return $this->belongsTo(Client::class, 'client_id');
|
||
|
}
|
||
|
|
||
|
public function members()
|
||
|
{
|
||
|
return Employee::whereIn('id', $this->members_id)->get();
|
||
|
}
|
||
|
|
||
|
}
|