¨4.0.1¨
This commit is contained in:
@@ -9,36 +9,28 @@ use Cartalyst\Sentinel\Laravel\Facades\Sentinel as SentinelFacade;
|
||||
|
||||
class Sentinel implements Guard
|
||||
{
|
||||
/**
|
||||
* Determine if the current user is authenticated.
|
||||
*
|
||||
* @return \Modules\User\Entities\User|bool
|
||||
*/
|
||||
public function check()
|
||||
{
|
||||
return SentinelFacade::check();
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if the current user is a guest.
|
||||
*
|
||||
* @return \Modules\User\Entities\User|bool
|
||||
* @return User|bool
|
||||
*/
|
||||
public function guest()
|
||||
{
|
||||
return SentinelFacade::guest();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the currently authenticated user.
|
||||
*
|
||||
* @return \Illuminate\Contracts\Auth\Authenticatable|null
|
||||
* @return Authenticatable|null
|
||||
*/
|
||||
public function user()
|
||||
{
|
||||
return SentinelFacade::getUser();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the ID for the currently authenticated user.
|
||||
*
|
||||
@@ -53,10 +45,23 @@ class Sentinel implements Guard
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Determine if the current user is authenticated.
|
||||
*
|
||||
* @return User|bool
|
||||
*/
|
||||
public function check()
|
||||
{
|
||||
return SentinelFacade::check();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Validate a user's credentials.
|
||||
*
|
||||
* @param array $credentials
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function validate(array $credentials = [])
|
||||
@@ -64,40 +69,46 @@ class Sentinel implements Guard
|
||||
return SentinelFacade::validForCreation($credentials);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set the current user.
|
||||
*
|
||||
* @param \Illuminate\Contracts\Auth\Authenticatable $user
|
||||
* @param \Modules\User\Entities\User|bool
|
||||
* @param Authenticatable $user
|
||||
* @param User|bool
|
||||
*/
|
||||
public function setUser(Authenticatable $user)
|
||||
{
|
||||
return SentinelFacade::login($user);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Alias to set the current user.
|
||||
*
|
||||
* @param \Illuminate\Contracts\Auth\Authenticatable $user
|
||||
* @return \Modules\User\Entities\User|bool
|
||||
* @param Authenticatable $user
|
||||
*
|
||||
* @return User|bool
|
||||
*/
|
||||
public function login(Authenticatable $user)
|
||||
{
|
||||
return $this->setUser($user);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Attempt to logging in user.
|
||||
*
|
||||
* @param array $credentials
|
||||
* @param bool $remember
|
||||
* @return \Modules\User\Entities\User|bool
|
||||
*
|
||||
* @return User|bool
|
||||
*/
|
||||
public function attempt(array $credentials, $remember = false)
|
||||
{
|
||||
return SentinelFacade::authenticate($credentials, $remember);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Logout user.
|
||||
*
|
||||
@@ -108,11 +119,13 @@ class Sentinel implements Guard
|
||||
return SentinelFacade::logout();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Login using user id.
|
||||
*
|
||||
* @param int $userId
|
||||
* @return \Modules\User\Entities\User|bool
|
||||
*
|
||||
* @return User|bool
|
||||
*/
|
||||
public function loginUsingId($userId)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user