Add Distance Calculation

This commit is contained in:
R
2022-09-17 09:50:19 +07:00
parent 2b93a5a830
commit e4fba1f51a
2 changed files with 39 additions and 4 deletions

View File

@@ -22,7 +22,7 @@ class HospitalResource extends JsonResource
'address' => $this->currentAddress->text ?? null,
'lat' => $this->currentAddress->lat ?? null,
'lng' => $this->currentAddress->lng ?? null,
'distance' => '200 m',
'distance' => isset($this->distance_km) ? round($this->distance_km) . ' km' : '-',
'city_name' => 'Kota Tangerang',
'phone' => $this->meta->phone,
'photo_url' => asset('images/default-hospital-image.png'),