boundary) { $rings = $this->boundary->getGeometries(); $ring = $rings->first(); if ($ring) { $boundaryPoints = $ring->getGeometries() ->map(fn ($p) => ['lat' => $p->latitude, 'lng' => $p->longitude]) ->all(); } } return [ 'id' => $this->id, 'psgc_code' => $this->psgc_code, 'code' => $this->code, 'name' => $this->name, 'urban_rural' => $this->urban_rural, 'population' => $this->population, 'city_municipality_id' => $this->city_municipality_id, 'centroid' => $this->centroid ? [ 'lat' => $this->centroid->latitude, 'lng' => $this->centroid->longitude, ] : null, 'boundary' => $boundaryPoints, 'city_municipality' => CityMunicipalityResource::make($this->whenLoaded('cityMunicipality')), ]; } }