'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 photos() { return $this->hasMany(Photo::class, 'person_id', 'person_id'); } public function profilePhoto() { return $this->hasMany(Photo::class, 'person_id', 'person_id') ->where('is_profile_photo', true) ->latest() ->first(); } }