55 lines
1.1 KiB
PHP
55 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
|
|
|
class Patient extends Model
|
|
{
|
|
use HasFactory, SoftDeletes;
|
|
|
|
protected $fillable = [
|
|
'patient_code',
|
|
'first_name',
|
|
'last_name',
|
|
'email',
|
|
'phone',
|
|
'date_of_birth',
|
|
'gender',
|
|
'address',
|
|
'emergency_contact_name',
|
|
'emergency_contact_phone',
|
|
'medical_history',
|
|
'allergies',
|
|
'notes',
|
|
'created_by',
|
|
];
|
|
|
|
protected $casts = [
|
|
'date_of_birth' => 'date',
|
|
];
|
|
|
|
public function appointments(): HasMany
|
|
{
|
|
return $this->hasMany(Appointment::class);
|
|
}
|
|
|
|
public function treatments(): HasMany
|
|
{
|
|
return $this->hasMany(Treatment::class);
|
|
}
|
|
|
|
public function invoices(): HasMany
|
|
{
|
|
return $this->hasMany(Invoice::class);
|
|
}
|
|
|
|
public function fullName(): string
|
|
{
|
|
return "{$this->first_name} {$this->last_name}";
|
|
}
|
|
}
|