Conoslidate external URLs for a place into a single JSON column

This commit is contained in:
Jonny Barnes 2017-06-29 12:34:25 +01:00
parent 3d734201a2
commit 8ae5d4e770
6 changed files with 63 additions and 22 deletions

View file

@ -47,7 +47,11 @@ class PlaceService
{
//check if the place exists if from swarm
if (array_key_exists('url', $checkin['properties']) && ends_with(parse_url($checkin['properties']['url'][0], PHP_URL_HOST), 'foursquare.com')) {
$place = Place::where('foursquare', $checkin['properties']['url'][0])->get();
$place = Place::where(
'external_urls',
'@>',
json_encode('foursquare' => $checkin['properties']['url'][0]
)->get();
if (count($place) === 1) {
return $place->first();
}