@php $nearbyLocations = App\Models\NearByLocation::where('listing_id', $listing->id)->get(); @endphp @php $coordinates = $nearbyLocations->map(function ($location) { return [ 'latitude' => $location->latitude, 'longitude' => $location->longitude, 'name' => $location->name, 'type' => $location->type, ]; }); @endphp

{{ get_phrase('Nearby') }}

@foreach (['school', 'hospital', 'shopping_center'] as $type) @if ($nearbyLocations->where('type', $type)->isNotEmpty())

{{ get_phrase(ucfirst(str_replace('_', ' ', $type))) }}

@endif @endforeach
@foreach (['school', 'hospital', 'shopping_center'] as $type) @if ($nearbyLocations->where('type', $type)->isNotEmpty()) @endif @endforeach