SessionGuard (Auth)
SessionGuard
class SessionGuard implements StatefulGuard, SupportsBasicAuth (View source)
Traits
GuardHelpers | These methods are typically the same across all guards. |
Macroable |
Methods
Authenticatable | authenticate() Determine if the current user is authenticated. | from GuardHelpers |
bool | check() Determine if the current user is authenticated. | from GuardHelpers |
bool | guest() Determine if the current user is a guest. | from GuardHelpers |
int|null | id() Get the ID for the currently authenticated user. | |
void | setUser(Authenticatable $user) Set the current user. | |
static void | macro(string $name, callable $macro) Register a custom macro. | from Macroable |
static bool | hasMacro(string $name) Checks if macro is registered. | from Macroable |
static mixed | __callStatic(string $method, array $parameters) Dynamically handle calls to the class. | from Macroable |
mixed | __call(string $method, array $parameters) Dynamically handle calls to the class. | from Macroable |
void | __construct(string $name, UserProvider $provider, Session $session, Request $request = null) Create a new authentication guard. | |
Authenticatable|null | user() Get the currently authenticated user. | |
bool | once(array $credentials = array()) Log a user into the application without sessions or cookies. | |
bool | onceUsingId(mixed $id) Log the given user ID into the application without sessions or cookies. | |
bool | validate(array $credentials = array()) Validate a user's credentials. | |
Response|null | basic(string $field = 'email', array $extraConditions = array()) Attempt to authenticate using HTTP Basic Auth. | |
Response|null | onceBasic(string $field = 'email', array $extraConditions = array()) Perform a stateless HTTP Basic login attempt. | |
bool | attempt(array $credentials = array(), bool $remember = false) Attempt to authenticate a user using the given credentials. | |
Authenticatable | loginUsingId(mixed $id, bool $remember = false) Log the given user ID into the application. | |
void | login(Authenticatable $user, bool $remember = false) Log a user into the application. | |
void | logout() Log the user out of the application. | |
void | attempting(mixed $callback) Register an authentication attempt event listener. | |
Authenticatable | getLastAttempted() Get the last user we attempted to authenticate. | |
string | getName() Get a unique identifier for the auth session value. | |
string | getRecallerName() Get the name of the cookie used to store the "recaller". | |
bool | viaRemember() Determine if the user was authenticated via "remember me" cookie. | |
QueueingFactory | getCookieJar() Get the cookie creator instance used by the guard. | |
void | setCookieJar(QueueingFactory $cookie) Set the cookie creator instance used by the guard. | |
Dispatcher | getDispatcher() Get the event dispatcher instance. | |
void | setDispatcher(Dispatcher $events) Set the event dispatcher instance. | |
Store | getSession() Get the session store used by the guard. | |
UserProvider | getProvider() Get the user provider used by the guard. | |
void | setProvider(UserProvider $provider) Set the user provider used by the guard. | |
Authenticatable|null | getUser() Return the currently cached user. | |
Request | getRequest() Get the current request instance. | |
$this | setRequest(Request $request) Set the current request instance. |
Details
Authenticatable authenticate()
Determine if the current user is authenticated.
bool check()
Determine if the current user is authenticated.
bool guest()
Determine if the current user is a guest.
int|null id()
Get the ID for the currently authenticated user.
void setUser(Authenticatable $user)
Set the current user.
static void macro(string $name, callable $macro)
Register a custom macro.
static bool hasMacro(string $name)
Checks if macro is registered.
static mixed __callStatic(string $method, array $parameters)
Dynamically handle calls to the class.
mixed __call(string $method, array $parameters)
Dynamically handle calls to the class.
void __construct(string $name, UserProvider $provider, Session $session, Request $request = null)
Create a new authentication guard.
Authenticatable|null user()
Get the currently authenticated user.
bool once(array $credentials = array())
Log a user into the application without sessions or cookies.
bool onceUsingId(mixed $id)
Log the given user ID into the application without sessions or cookies.
bool validate(array $credentials = array())
Validate a user's credentials.
Response|null basic(string $field = 'email', array $extraConditions = array())
Attempt to authenticate using HTTP Basic Auth.
Response|null onceBasic(string $field = 'email', array $extraConditions = array())
Perform a stateless HTTP Basic login attempt.
bool attempt(array $credentials = array(), bool $remember = false)
Attempt to authenticate a user using the given credentials.
Authenticatable loginUsingId(mixed $id, bool $remember = false)
Log the given user ID into the application.
void login(Authenticatable $user, bool $remember = false)
Log a user into the application.
void logout()
Log the user out of the application.
void attempting(mixed $callback)
Register an authentication attempt event listener.
Authenticatable getLastAttempted()
Get the last user we attempted to authenticate.
string getName()
Get a unique identifier for the auth session value.
string getRecallerName()
Get the name of the cookie used to store the "recaller".
bool viaRemember()
Determine if the user was authenticated via "remember me" cookie.
QueueingFactory getCookieJar()
Get the cookie creator instance used by the guard.
void setCookieJar(QueueingFactory $cookie)
Set the cookie creator instance used by the guard.
Dispatcher getDispatcher()
Get the event dispatcher instance.
void setDispatcher(Dispatcher $events)
Set the event dispatcher instance.
Store getSession()
Get the session store used by the guard.
UserProvider getProvider()
Get the user provider used by the guard.
void setProvider(UserProvider $provider)
Set the user provider used by the guard.
Authenticatable|null getUser()
Return the currently cached user.
Request getRequest()
Get the current request instance.
$this setRequest(Request $request)
Set the current request instance.
© Taylor Otwell
Licensed under the MIT License.
Laravel is a trademark of Taylor Otwell.
https://laravel.com/api/5.4/Illuminate/Auth/SessionGuard.html