Manually create a Place model to force laravel to access postgis methods
This commit is contained in:
parent
19d982580a
commit
a7dd02f144
1 changed files with 11 additions and 7 deletions
|
@ -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();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue