60 lines
1.1 KiB
PHP
60 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
|
|
|
class Deceased extends Model
|
|
{
|
|
use HasFactory;
|
|
|
|
/**
|
|
* The table associated with the model.
|
|
*
|
|
* @var string
|
|
*/
|
|
protected $table = 'deceased';
|
|
|
|
/**
|
|
* The attributes that are mass assignable.
|
|
*
|
|
* @var array
|
|
*/
|
|
protected $fillable = [
|
|
'last_name',
|
|
'first_name',
|
|
'birth_date',
|
|
'death_date',
|
|
'place_of_death',
|
|
'notes'
|
|
];
|
|
|
|
/**
|
|
* The attributes that should be cast.
|
|
*
|
|
* @var array
|
|
*/
|
|
protected $casts = [
|
|
'birth_date' => 'date',
|
|
'death_date' => 'date',
|
|
];
|
|
|
|
/**
|
|
* Get the documents associated with the deceased.
|
|
*/
|
|
public function documents(): HasMany
|
|
{
|
|
return $this->hasMany(DeceasedDocument::class);
|
|
}
|
|
|
|
/**
|
|
* Get the interventions associated with the deceased.
|
|
*/
|
|
public function interventions(): HasMany
|
|
{
|
|
return $this->hasMany(Intervention::class);
|
|
}
|
|
}
|