api doctor detail
This commit is contained in:
@@ -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