api doctor detail
This commit is contained in:
@@ -17,7 +17,7 @@ class DoctorResource extends JsonResource
|
||||
return [
|
||||
'id' => $this->practitioner->person->id,
|
||||
'name' => $this->practitioner->person->name,
|
||||
'specialis' => $this->speciality->name,
|
||||
'specialis' => "Spesialis " . $this->speciality->name,
|
||||
'photos' => [
|
||||
'title' => 'doctors-avatar-' . $this->id,
|
||||
'url' => asset('images/default-doctor-avatar.png')
|
||||
|
||||
@@ -15,10 +15,16 @@ class HospitalResource extends JsonResource
|
||||
*/
|
||||
public function toArray($request)
|
||||
{
|
||||
if (empty($this->distance)) {
|
||||
$address = $this->currentAddress->text;
|
||||
} else {
|
||||
$address = $this->currentAddress;
|
||||
}
|
||||
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'name' => $this->name,
|
||||
'address' => $this->currentAddress->text ?? null,
|
||||
'address' => $address ?? null,
|
||||
'distance' => $this->distance ? ($this->distance < 1 ? round($this->distance * 1000, 2) . " m" : round($this->distance, 2) . " km") : null,
|
||||
'photos' => [
|
||||
'title' => Str::slug($this->name),
|
||||
|
||||
Reference in New Issue
Block a user