53 lines
1.1 KiB
PHP
53 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\BelongsTo;
|
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
|
|
|
class HouseholdMember extends Model
|
|
{
|
|
use HasFactory, SoftDeletes;
|
|
|
|
public const RELATIONSHIP_HEAD = 'head';
|
|
|
|
public const RELATIONSHIP_SPOUSE = 'spouse';
|
|
|
|
public const RELATIONSHIP_CHILD = 'child';
|
|
|
|
public const RELATIONSHIP_PARENT = 'parent';
|
|
|
|
public const RELATIONSHIP_SIBLING = 'sibling';
|
|
|
|
public const RELATIONSHIP_OTHER = 'other';
|
|
|
|
protected $fillable = [
|
|
'household_id',
|
|
'user_id',
|
|
'relationship',
|
|
'full_name',
|
|
'date_of_birth',
|
|
'joined_at',
|
|
];
|
|
|
|
protected function casts(): array
|
|
{
|
|
return [
|
|
'date_of_birth' => 'date',
|
|
'joined_at' => 'datetime',
|
|
];
|
|
}
|
|
|
|
public function household(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Household::class);
|
|
}
|
|
|
|
public function user(): BelongsTo
|
|
{
|
|
return $this->belongsTo(User::class);
|
|
}
|
|
}
|