Manually create a Place model to force laravel to access postgis methods

This commit is contained in:
Jonny Barnes 2016-10-06 01:03:22 +01:00
parent 19d982580a
commit a7dd02f144

View file

@ -51,9 +51,12 @@ class SyndicateToTwitter implements ShouldQueue
$lat = trim($location[0]); $lat = trim($location[0]);
$lng = trim($location[1]); $lng = trim($location[1]);
} }
if ($this->note->place) { if ($this->note->place_id) {
$lat = $this->note->place->location->getLat(); //we force the job to create a place model to get access
$lng = $this->note->place->location->getLng(); //to the postgis methods
$place = Place::find($this->note->place_id)
$lat = $place->location->getLat();
$lng = $place->location->getLng();
} }
if (isset($lat) && isset($lng)) { if (isset($lat) && isset($lng)) {
$tweetOpts['lat'] = $lat; $tweetOpts['lat'] = $lat;
@ -69,10 +72,11 @@ class SyndicateToTwitter implements ShouldQueue
$tweetOpts['media_ids'] = implode(',', $mediaIds); $tweetOpts['media_ids'] = implode(',', $mediaIds);
} }
$responseJson = Twitter::postTweet($tweetOpts); //$responseJson = Twitter::postTweet($tweetOpts);
$response = json_decode($responseJson); //$response = json_decode($responseJson);
$tweetId = $response->id; //$tweetId = $response->id;
$this->note->tweet_id = $tweetId; var_dump($tweetOpts);
$this->note->tweet_id = '55667788';
$this->note->save(); $this->note->save();
} }