[ 'name' => $this->full_name ?? null, 'weight' => $this->person->last_weight_kg ?? null, 'height' => $this->person->last_height_kg ?? null, 'placeOfBirth' => ucwords($this->person->birth_place) ?? null, 'dateOfBirth' => $this->birth_date ?? $this->person->birth_date, 'gender' => ucwords(strtolower($this->gender ?? $this->person->gender)), 'phoneNumber' => $this->person->phone ?? null, 'email' => $this->email ?? ($this->person->email ?? null), 'address' => $this->person->last_height_kg ?? null, 'idNumber' => $this->person->nik ?? null, 'religion' => ucwords(strtolower($this->person->religion)) ?? null, 'maritalStatus' => $this->marital_status, 'education' => ucwords(strtolower($this->person->last_education)) ?? null, 'occupation' => null, ], 'families' => collect($this->families)->map(function ($family) { return [ 'name' => $family->full_name ?? null, 'relationship' => $family->relationship ?? null, 'dateOfBirth' => $family->birth_date ?? $family->person->birth_date, 'email' => $this->email ?? ($this->person->email ?? null), 'phoneNumber' => $this->person->phone ?? null, 'status' => $this->status ?? null ]; })->all() ]; } }