*/ use HasFactory; use Searchable; use SoftDeletes; protected $fillable = [ 'address', 'country', 'post_code', 'city', 'type_id', 'description', 'person_id', 'user_id', ]; protected $hidden = [ 'user_id', 'person_id', 'deleted', ]; public function toSearchableArray(): array { return [ 'address' => $this->address, 'country' => $this->country, 'post_code' => $this->post_code, 'city' => $this->city, ]; } protected static function booted() { static::creating(function (PersonAddress $address) { $address->user_id = auth()->id(); }); } public function person(): BelongsTo { return $this->belongsTo(\App\Models\Person\Person::class); } public function type(): BelongsTo { return $this->belongsTo(\App\Models\Person\AddressType::class, 'type_id'); } }