47 lines
969 B
PHP
47 lines
969 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
|
|
class DataCentreConsultantAssignment extends Model
|
|
{
|
|
use HasFactory;
|
|
|
|
protected $fillable = [
|
|
'data_centre_id',
|
|
'consultant_id',
|
|
'start_date',
|
|
'end_date',
|
|
'reason',
|
|
'assigned_by',
|
|
'is_active',
|
|
];
|
|
|
|
protected function casts(): array
|
|
{
|
|
return [
|
|
'start_date' => 'date',
|
|
'end_date' => 'date',
|
|
'is_active' => 'boolean',
|
|
];
|
|
}
|
|
|
|
public function dataCentre(): BelongsTo
|
|
{
|
|
return $this->belongsTo(DataCentre::class);
|
|
}
|
|
|
|
public function consultant(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Consultant::class);
|
|
}
|
|
|
|
public function assignedBy(): BelongsTo
|
|
{
|
|
return $this->belongsTo(User::class, 'assigned_by');
|
|
}
|
|
}
|