From a7dd02f144e9aba0d22944567c15ff4481fe2e08 Mon Sep 17 00:00:00 2001 From: Jonny Barnes Date: Thu, 6 Oct 2016 01:03:22 +0100 Subject: [PATCH 1/4] Manually create a Place model to force laravel to access postgis methods --- app/Jobs/SyndicateToTwitter.php | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/app/Jobs/SyndicateToTwitter.php b/app/Jobs/SyndicateToTwitter.php index 0e0bf3f7..491b3f06 100644 --- a/app/Jobs/SyndicateToTwitter.php +++ b/app/Jobs/SyndicateToTwitter.php @@ -51,9 +51,12 @@ class SyndicateToTwitter implements ShouldQueue $lat = trim($location[0]); $lng = trim($location[1]); } - if ($this->note->place) { - $lat = $this->note->place->location->getLat(); - $lng = $this->note->place->location->getLng(); + if ($this->note->place_id) { + //we force the job to create a place model to get access + //to the postgis methods + $place = Place::find($this->note->place_id) + $lat = $place->location->getLat(); + $lng = $place->location->getLng(); } if (isset($lat) && isset($lng)) { $tweetOpts['lat'] = $lat; @@ -69,10 +72,11 @@ class SyndicateToTwitter implements ShouldQueue $tweetOpts['media_ids'] = implode(',', $mediaIds); } - $responseJson = Twitter::postTweet($tweetOpts); - $response = json_decode($responseJson); - $tweetId = $response->id; - $this->note->tweet_id = $tweetId; + //$responseJson = Twitter::postTweet($tweetOpts); + //$response = json_decode($responseJson); + //$tweetId = $response->id; + var_dump($tweetOpts); + $this->note->tweet_id = '55667788'; $this->note->save(); } From c25f2f349d7ebf711728da55dfdbd1b0a83badb4 Mon Sep 17 00:00:00 2001 From: Jonny Barnes Date: Thu, 6 Oct 2016 01:04:23 +0100 Subject: [PATCH 2/4] Remove comments from testing --- app/Jobs/SyndicateToTwitter.php | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/app/Jobs/SyndicateToTwitter.php b/app/Jobs/SyndicateToTwitter.php index 491b3f06..bc49bd16 100644 --- a/app/Jobs/SyndicateToTwitter.php +++ b/app/Jobs/SyndicateToTwitter.php @@ -4,6 +4,7 @@ namespace App\Jobs; use Twitter; use App\Note; +use App\Place; use App\Contact; use Illuminate\Bus\Queueable; use Jonnybarnes\IndieWeb\Numbers; @@ -72,11 +73,9 @@ class SyndicateToTwitter implements ShouldQueue $tweetOpts['media_ids'] = implode(',', $mediaIds); } - //$responseJson = Twitter::postTweet($tweetOpts); - //$response = json_decode($responseJson); - //$tweetId = $response->id; - var_dump($tweetOpts); - $this->note->tweet_id = '55667788'; + $responseJson = Twitter::postTweet($tweetOpts); + $response = json_decode($responseJson); + $this->note->tweet_id = $response->id; $this->note->save(); } From 5723ba4b9c3d4768dbe86489815d2abddbc075e8 Mon Sep 17 00:00:00 2001 From: Jonny Barnes Date: Thu, 6 Oct 2016 01:06:41 +0100 Subject: [PATCH 3/4] Add fix to changelog --- changelog.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/changelog.md b/changelog.md index 6e727822..5b820cb8 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,8 @@ # Changelog +## Version {next} + - Create a Place model instance in SyndicateToTwitter job to force laravel to access postgis methods + ## Version 0.0.13.7 (2016-10-05) - Use the correct `laravel-postgis` method call during syndication From e9838cea46bb8a9bb4d826c73c1f83354c5bad90 Mon Sep 17 00:00:00 2001 From: Jonny Barnes Date: Thu, 6 Oct 2016 01:07:41 +0100 Subject: [PATCH 4/4] Bump version --- changelog.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/changelog.md b/changelog.md index 5b820cb8..92649bf9 100644 --- a/changelog.md +++ b/changelog.md @@ -1,6 +1,6 @@ # Changelog -## Version {next} +## Version 0.0.13.8 (2016-10-06) - Create a Place model instance in SyndicateToTwitter job to force laravel to access postgis methods ## Version 0.0.13.7 (2016-10-05)