public fetchFollowers ( ) : array | Illuminate\View\View | ||
return | array | Illuminate\View\View |
public function fetchFollowers()
{
try {
$client = initTwitter();
$pageId = $this->config->TwitterId();
$lookup = $client->get('users/show/followers_count.json?user_id=' . $pageId);
return json_decode($lookup->getBody(), true);
} catch (\GuzzleHttp\Exception\ClientException $e) {
getErrorMessage($e->getResponse()->getStatusCode());
return back();
}
}
/** * Update config file with followers * @return void */ public function updateTwitterDashboardStats() { $followers = $this->twitterContent->fetchFollowers(); $config = $this->config->first(); $config->twitter_followers = $followers['followers_count']; $config->save(); }