51 lines
1.0 KiB
PHP
51 lines
1.0 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Models;
|
|
|
|
use App\Casts\JalaliDatetime;
|
|
use App\Traits\HasUserStamps;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
|
|
class SurgeryAppointment extends Model
|
|
{
|
|
use HasUserStamps;
|
|
|
|
protected $fillable = [
|
|
'patient_id',
|
|
'surgery_date',
|
|
'surgery_center_id',
|
|
];
|
|
|
|
protected function casts(): array
|
|
{
|
|
return [
|
|
'surgery_date' => 'datetime',
|
|
'created_at' => JalaliDatetime::class,
|
|
'updated_at' => JalaliDatetime::class,
|
|
];
|
|
}
|
|
|
|
public function patient(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Patient::class);
|
|
}
|
|
|
|
public function surgeryCenter(): BelongsTo
|
|
{
|
|
return $this->belongsTo(SurgeryCenter::class);
|
|
}
|
|
|
|
public function creator(): BelongsTo
|
|
{
|
|
return $this->belongsTo(User::class, 'created_by');
|
|
}
|
|
|
|
public function updator(): BelongsTo
|
|
{
|
|
return $this->belongsTo(User::class, 'updated_by');
|
|
}
|
|
}
|