fix route dashboard

This commit is contained in:
Muhammad Fajar
2022-10-26 09:35:51 +07:00
parent d0ce5772c2
commit 0ece467d21
3 changed files with 31 additions and 30 deletions

View File

@@ -18,8 +18,8 @@ class HospitalResource extends JsonResource
return [
'id' => $this->id,
'name' => $this->name,
'address' => $this->currentAddress ?? null,
'distance' => $this->distance < 1 ? round($this->distance * 1000, 2) . " m" : round($this->distance, 2) . " km",
'address' => $this->currentAddress->text ?? 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),
'url' => asset('images/default-doctor-avatar.png')