client = new \Google_Client(); } public function init() { $this->client->setClientId(config('ninja.auth.google.client_id')); $this->client->setClientSecret(config('ninja.auth.google.client_secret')); return $this; } public function getClient() { return $this->client; } public function checkAccessToken() { } public function refreshToken($user) { if ($this->client->isAccessTokenExpired()) { $this->client->fetchAccessTokenWithRefreshToken($user->oauth_user_refresh_token); $access_token = $this->client->getAccessToken(); $user->oauth_user_token = $access_token; $user->save(); } return $this; } }