first()) { $token['expires'] = strtotime($token['expires']); return $token; } return false; } public function setAccessToken($access_token, $client_id, $user_id, $expires, $scope = null) { $expires = date('Y-m-d H:i:s', $expires); if ($this->getAccessToken($access_token)) { return Models\AccessToken::where('access_token', $access_token)->update([ 'client_id' => $client_id, 'user_id' => $user_id, 'expires' => $expires, 'scope' => $scope, ]); } else { return Models\AccessToken::create([ 'access_token' => $access_token, 'client_id' => $client_id, 'user_id' => $user_id, 'expires' => $expires, 'scope' => $scope, ]); } } public function unsetAccessToken($access_token) { return Models\AccessToken::where('access_token', $access_token)->delete(); } }