Rubenwouters\CrmLauncher\Updates\UpdateStatistics::updateTwitterStats PHP Method

updateTwitterStats() public method

Update stats in DB (like count & retweet count)
public updateTwitterStats ( ) : void
return void
    public function updateTwitterStats()
    {
        $tweets = $this->twitterContent->fetchTwitterStats();
        foreach ($tweets as $key => $tweet) {
            if ($this->publishment->where('tweet_id', $tweet['id_str'])->exists()) {
                $publishment = $this->publishment->where('tweet_id', $tweet['id_str'])->first();
                $publishment->twitter_likes = $tweet['favorite_count'];
                $publishment->twitter_retweets = $tweet['retweet_count'];
                $publishment->save();
            }
        }
        $this->log->updateLog('publishments');
    }