2025-10-16 17:29:31 +03:00

39 lines
714 B
PHP

<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
class Contact extends Model
{
protected $fillable = [
'first_name',
'last_name',
'email',
'phone',
'mobile',
'position',
'notes',
'is_primary',
'client_id'
];
protected $casts = [
'is_primary' => 'boolean',
];
public function client(): BelongsTo
{
return $this->belongsTo(Client::class);
}
/**
* Get the contact's full name.
*/
public function getFullNameAttribute(): string
{
return trim("{$this->first_name} {$this->last_name}");
}
}