diff --git a/Modules/Linksehat/Transformers/Doctor/DoctorResourceDetail.php b/Modules/Linksehat/Transformers/Doctor/DoctorResourceDetail.php index 83fb48e4..3b1fcc51 100755 --- a/Modules/Linksehat/Transformers/Doctor/DoctorResourceDetail.php +++ b/Modules/Linksehat/Transformers/Doctor/DoctorResourceDetail.php @@ -59,24 +59,24 @@ class DoctorResourceDetail extends JsonResource $queryHospitals = $queryHospitals->orderBy('organizations.name', 'asc')->where('organizations.id', $this->organization_id)->get(); return [ - 'name' => $this->person->full_name, + 'name' => $this->person->full_name ?? null, 'length_of_work_year' => rand(1, 20), - 'price' => $prices, + 'price' => empty($prices) ? null : $prices, 'rating' => rand(50, 100), 'photos' => [ - 'title' => 'doctor-avatar-' . $this->person->id, + 'title' => 'doctor-avatar-' . $this->person->id ?? null, 'url' => asset('images/default-doctor-avatar.png') ], - 'spesialis' => $spesialis, - 'award' => $award, - 'education' => $education, - 'location_practect' => HospitalResource::collection($queryHospitals), + 'spesialis' => empty($spesialis) ? null : $spesialis, + 'award' => empty($award) ? null : $award, + 'education' => empty($education) ? null : $education, + 'location_practect' => empty($queryHospitals) ? null : HospitalResource::collection($queryHospitals), 'available' => [ - 'is_chat_available' => $isChatAvailable, - 'is_video_available' => $isVideoAvailable, - 'is_walkin_available' => $isWalkinAvailable, - 'is_instant_chat_available' => $isInstantChatAvailable, - 'day_available' => $this->day_available + 'is_chat_available' => $isChatAvailable ?? null, + 'is_video_available' => $isVideoAvailable ?? null, + 'is_walkin_available' => $isWalkinAvailable ?? null, + 'is_instant_chat_available' => $isInstantChatAvailable ?? null, + 'day_available' => $this->day_available ?? null ] ]; }