When a place already exists, return an instance of that place, not a collection of length 1

This commit is contained in:
Jonny Barnes 2017-06-27 17:40:37 +01:00
parent 42a0f7c6c3
commit 3d734201a2

View file

@ -49,7 +49,7 @@ class PlaceService
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();
if (count($place) === 1) {
return $place;
return $place->first();
}
}
if (array_key_exists('name', $checkin['properties']) === false) {