Remove the postgis stuff

This commit is contained in:
Jonny Barnes 2020-10-16 20:45:07 +01:00
parent 73fdd9a1ed
commit 3c3ad3e29d
10 changed files with 589 additions and 656 deletions

View file

@ -80,10 +80,8 @@ class PlacesController extends Controller
$place = Place::findOrFail($placeId);
$place->name = request()->input('name');
$place->description = request()->input('description');
$place->location = new Point(
(float) request()->input('latitude'),
(float) request()->input('longitude')
);
$place->latitude = request()->input('latitude');
$place->longitude = request()->input('longitude');
$place->icon = request()->input('icon');
$place->save();
@ -99,7 +97,7 @@ class PlacesController extends Controller
public function mergeIndex(int $placeId): View
{
$first = Place::find($placeId);
$results = Place::near(new Point($first->latitude, $first->longitude))->get();
$results = Place::near((object) ['latitude' => $first->latitude, 'longitude' =>$first->longitude])->get();
$places = [];
foreach ($results as $place) {
if ($place->slug !== $first->slug) {

View file

@ -142,7 +142,10 @@ class MicropubController extends Controller
$matches
);
$distance = (count($matches[0]) == 3) ? 100 * $matches[0][2] : 1000;
$places = Place::near(new Point($matches[0][0], $matches[0][1]))->get();
$places = Place::near(
(object) ['latitude' => $matches[0][0], 'longitude' => $matches[0][1]],
$distance
)->get();
return response()->json([
'response' => 'places',