60 lines
1.2 KiB
PHP
60 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
|
|
|
class Person extends Model
|
|
{
|
|
use HasFactory, SoftDeletes;
|
|
|
|
protected $table = 'person';
|
|
protected $primaryKey = 'person_id';
|
|
|
|
protected $fillable = [
|
|
'surname',
|
|
'christian_name',
|
|
'full_name',
|
|
'date_of_birth',
|
|
'place_of_birth',
|
|
'date_of_death',
|
|
'occupation',
|
|
'additional_notes',
|
|
'reference',
|
|
'id_card_no',
|
|
];
|
|
|
|
protected $casts = [
|
|
'date_of_birth' => 'date',
|
|
'date_of_death' => 'date',
|
|
];
|
|
|
|
// Relationships
|
|
public function migration()
|
|
{
|
|
return $this->hasOne(Migration::class, 'person_id');
|
|
}
|
|
|
|
public function naturalization()
|
|
{
|
|
return $this->hasOne(Naturalization::class, 'person_id');
|
|
}
|
|
|
|
public function residence()
|
|
{
|
|
return $this->hasOne(Residence::class, 'person_id');
|
|
}
|
|
|
|
public function family()
|
|
{
|
|
return $this->hasOne(Family::class, 'person_id');
|
|
}
|
|
|
|
public function internment()
|
|
{
|
|
return $this->hasOne(Internment::class, 'person_id');
|
|
}
|
|
}
|