*/ class OAuth2User extends Model implements Authenticatable, Authorizable { const TABLE_NAME = 'oauth2_users'; protected $table = self::TABLE_NAME; public static function getById($id) { return self::query()->where('id', '=', intval($id))->first(); } /** * Determine if the entity has a given ability. * * @param string $ability * @param array|mixed $arguments * @return bool */ public function can($ability, $arguments = []) { return app(Gate::class)->forUser($this)->check($ability, $arguments); } /** * Get the name of the unique identifier for the user. * * @return string */ public function getAuthIdentifierName() { return 'id'; } /** * Get the unique identifier for the user. * * @return mixed */ public function getAuthIdentifier() { return $this->id; } /** * Get the password for the user. * * @return string */ public function getAuthPassword() { return ''; } /** * Get the token value for the "remember me" session. * * @return string */ public function getRememberToken() { return $this->rememberToken; } /** * Set the token value for the "remember me" session. * * @param string $value * @return void */ public function setRememberToken($value) { $this->remember_token = trim(strval($value)); } /** * Get the column name for the "remember me" token. * * @return string */ public function getRememberTokenName() { return 'remember_token'; } }