Fix Person

This commit is contained in:
R
2022-11-15 10:43:30 +07:00
parent 961be7568d
commit 897a531326
4 changed files with 56 additions and 8 deletions

View File

@@ -17,21 +17,30 @@ class PersonResource extends JsonResource
{
return [
'id' => $this->id,
'name_prefix' => $this->name_prefix,
'name' => $this->name,
'name_suffix' => $this->name_suffix,
'full_name' => $this->full_name,
'birth_place' => $this->birth_place,
'gender' => $this->gender,
'birth_date' => $this->birth_date,
'gender' => !empty($this->gender) ? ($this->gender == 'M' ? 'P' : 'W') : null, // For App
'citizenship' => $this->citizenship,
'phone' => $this->phone,
'email' => $this->email,
'blood_type' => $this->blood_type,
'weight' => $this->weight,
'height' => $this->height,
'weight' => (float) $this->last_weight_kg,
'height' => (float) $this->last_height_cm,
'relation_with_owner' => ($this->user && $this->user->person_id == $this->id) ? 'Self' : $this->pivot->relation_with_owner ?? null,
'marital_status' => $this->marital_status,
'last_education' => $this->last_education,
'current_employment' => $this->current_employment,
'nik' => $this->nik,
'religion' => $this->religion,
'is_deceased' => $this->is_deceased == 1,
'deceased_at' => $this->deceased_at,
'avatar_url' => $this->avatar->url ?? asset('images/default-doctor-avatar.png'),
'main_address' => $this->current_address,
'domicile_address' => $this->domicile_address,
];
}
}