map(function ($outlet) { return [ 'type' => 'Feature', 'properties' => new OutletResource($outlet), 'geometry' => [ 'type' => 'Point', 'coordinates' => [ $outlet->longitude, $outlet->latitude, ], ], ]; }); return response()->json([ 'type' => 'FeatureCollection', 'features' => $geoJSONdata, ]); } }