Don't send since_id if there's no newest post

This commit is contained in:
Oliver Davies 2019-01-15 23:50:11 +00:00
parent e3cca4f40c
commit 06d35d0515

View file

@ -49,12 +49,12 @@ class TweetFetcher
public function getTweets(): Collection public function getTweets(): Collection
{ {
$newestTweet = $this->tweetRepository->findNewestTweet(); $params = ['q' => collect($this->params()->all())->implode(' AND ')];
if ($newestTweet = $this->tweetRepository->findNewestTweet()) {
$params['since_id'] = $newestTweet->getId();
}
$response = collect($this->codebird->get()->search_tweets([ $response = collect($this->codebird->get()->search_tweets($params));
'q' => collect($this->params()->all())->implode(' AND '),
// 'since_id' => $newestTweet ? $newestTweet->getId() : null,
]));
if ($response->get('httpstatus') != 200) { if ($response->get('httpstatus') != 200) {
dump($response); dump($response);