country = request()->route('country'); $geoCountry = \Lwwcas\LaravelCountries\Models\Country::query() ->where('iso_alpha_2', str($this->country)->upper()) ->first() ?->coordinates() ->first(); $this->latitude = $geoCountry->latitude ?? 51.165691; $this->longitude = $geoCountry->longitude ?? 10.451526; } public function with(): array { return [ 'meetups' => Meetup::with(['city:id,longitude,latitude']) ->select([ 'meetups.id', 'meetups.city_id', 'meetups.name', ]) ->get(), ]; } }; ?>