'date', 'date_of_death' => 'date', ]; // 🔧 Configure Spatie logging public function getActivitylogOptions(): LogOptions { return LogOptions::defaults() ->useLogName('person') ->logFillable() ->logOnlyDirty(); } // 📝 Custom activity description for events public function getDescriptionForEvent(string $eventName): string { return match ($eventName) { 'created' => 'Added new migrant', 'updated' => 'Updated migrant details', 'deleted' => 'Deleted migrant record', default => ucfirst($eventName) . ' migrant record', }; } // 🔗 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'); } public function toSearchableArray() { return [ 'person_id' => $this->person_id, 'surname' => $this->surname, 'christian_name' => $this->christian_name, 'full_name' => $this->full_name, 'place_of_birth' => $this->place_of_birth, 'id_card_no' => $this->id_card_no, ]; } }