*/ public function toArray(Request $request): array { return [ 'person_id' => $this->person_id, 'surname' => $this->surname, 'christian_name' => $this->christian_name, 'full_name' => $this->full_name, 'date_of_birth' => $this->date_of_birth, 'place_of_birth' => $this->place_of_birth, 'date_of_death' => $this->date_of_death, 'occupation' => $this->occupation, 'additional_notes' => $this->additional_notes, 'reference' => $this->reference, 'id_card_no' => $this->id_card_no, 'created_at' => $this->created_at, 'updated_at' => $this->updated_at, // Include related resources when they're loaded 'migration' => new MigrationResource($this->whenLoaded('migration')), 'naturalization' => new NaturalizationResource($this->whenLoaded('naturalization')), 'residence' => new ResidenceResource($this->whenLoaded('residence')), 'family' => new FamilyResource($this->whenLoaded('family')), 'internment' => new InternmentResource($this->whenLoaded('internment')), ]; } }