コード例 #1
0
 /**
  * Update stats in DB (like count & retweet count)
  *
  * @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');
 }