From 3d734201a22d34da4d7d815dc5819c20675b48f4 Mon Sep 17 00:00:00 2001 From: Jonny Barnes Date: Tue, 27 Jun 2017 17:40:37 +0100 Subject: [PATCH] When a place already exists, return an instance of that place, not a collection of length 1 --- app/Services/PlaceService.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Services/PlaceService.php b/app/Services/PlaceService.php index 95dd1418..d6cd526d 100644 --- a/app/Services/PlaceService.php +++ b/app/Services/PlaceService.php @@ -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) {