diff --git a/app/Services/PlaceService.php b/app/Services/PlaceService.php index d6cd526d..5b21054c 100644 --- a/app/Services/PlaceService.php +++ b/app/Services/PlaceService.php @@ -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(); } diff --git a/composer.lock b/composer.lock index 24d8b3f7..0c532174 100644 --- a/composer.lock +++ b/composer.lock @@ -8,16 +8,16 @@ "packages": [ { "name": "aws/aws-sdk-php", - "version": "3.30.1", + "version": "3.30.2", "source": { "type": "git", "url": "https://github.com/aws/aws-sdk-php.git", - "reference": "d234cb5e111945eb4bfca7eda0eef07a25750b29" + "reference": "20539a38dc643a2700f80ae8647dbd1a05d3f7a9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/d234cb5e111945eb4bfca7eda0eef07a25750b29", - "reference": "d234cb5e111945eb4bfca7eda0eef07a25750b29", + "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/20539a38dc643a2700f80ae8647dbd1a05d3f7a9", + "reference": "20539a38dc643a2700f80ae8647dbd1a05d3f7a9", "shasum": "" }, "require": { @@ -84,7 +84,7 @@ "s3", "sdk" ], - "time": "2017-06-22T22:40:58+00:00" + "time": "2017-06-23T18:54:40+00:00" }, { "name": "barnabywalters/mf-cleaner", @@ -2728,16 +2728,16 @@ }, { "name": "psy/psysh", - "version": "v0.8.7", + "version": "v0.8.8", "source": { "type": "git", "url": "https://github.com/bobthecow/psysh.git", - "reference": "be969b9dc89dcaefdb9a3117fa91fa38bca19f50" + "reference": "fe65c30cbc55c71e61ba3a38b5a581149be31b8e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/bobthecow/psysh/zipball/be969b9dc89dcaefdb9a3117fa91fa38bca19f50", - "reference": "be969b9dc89dcaefdb9a3117fa91fa38bca19f50", + "url": "https://api.github.com/repos/bobthecow/psysh/zipball/fe65c30cbc55c71e61ba3a38b5a581149be31b8e", + "reference": "fe65c30cbc55c71e61ba3a38b5a581149be31b8e", "shasum": "" }, "require": { @@ -2797,7 +2797,7 @@ "interactive", "shell" ], - "time": "2017-06-20T12:51:31+00:00" + "time": "2017-06-24T06:16:19+00:00" }, { "name": "ramsey/uuid", diff --git a/database/migrations/2017_06_27_164743_update_places_table_add_external_urls.php b/database/migrations/2017_06_27_164743_update_places_table_add_external_urls.php new file mode 100644 index 00000000..bd58db29 --- /dev/null +++ b/database/migrations/2017_06_27_164743_update_places_table_add_external_urls.php @@ -0,0 +1,34 @@ +jsonb('external_urls')->nullable(); + $table->index('external_urls'); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('places', function (Blueprint $table) { + $table->dropIndex('places_external_urls_index'); + $table->dropColumn('external_urls'); + }); + } +} diff --git a/database/seeds/PlacesTableSeeder.php b/database/seeds/PlacesTableSeeder.php index 1fe4bea8..cef1ebb6 100644 --- a/database/seeds/PlacesTableSeeder.php +++ b/database/seeds/PlacesTableSeeder.php @@ -1,6 +1,8 @@ insert([ - 'name' => 'The Bridgewater Pub', - 'slug' => 'the-bridgewater-pub', - 'description' => 'A lovely local pub with a decent selection of cask ales', - 'location' => 'POINT(-2.3805 53.4983)', - 'created_at' => '2016-01-12 16:19:00', - 'updated_at' => '2016-01-12 16:19:00', + $place = new Place(); + $place->name = 'The Bridgewater Pub'; + $place->description = 'A lovely local pub with a decent selection of cask ales'; + $place->location = new Point('53.4983', '-2.3805'); + $place->external_urls = json_encode([ + 'foursqaure' => 'https://foursqaure.com/v/123435/the-bridgewater-pub', + 'osm' => 'https://www.openstreetmap.org/way/987654', ]); + $place->save(); } } diff --git a/package-lock.json b/package-lock.json index 04964a83..91e22361 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4329,9 +4329,9 @@ } }, "webStorage": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/webStorage/-/webStorage-1.2.3.tgz", - "integrity": "sha1-CHN87eWk2ouophKKYoQHB0Cwxxg=" + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/webStorage/-/webStorage-1.2.4.tgz", + "integrity": "sha1-/jNN8N5uLe58i9A2uxVaw115FTY=" }, "webworkify": { "version": "1.4.0", diff --git a/package.json b/package.json index 1cfbde8b..3a5f43dc 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,7 @@ "mapbox-gl": "^0.38.0", "marked": "^0.3.6", "normalize.css": "^7.0.0", - "webStorage": "^1.2.3" + "webStorage": "^1.2.4" }, "devDependencies": { "babel-cli": "^6.18.0",