Authentication
Authentication Configuration
The authentication configuration is set into the config/auth.json
file. Here is an example of authentication configuration:
The user model that will be used for authentication. The username and password checks will be done from this model.
Login
You have an auth()
helper that allows you to perform various operations related to authentication.
There's two functions for login user. The first is:
$credentials
is an array that contains values of type key => value, this array must contain the username and password required for the connection. Example:
The password does not need to be encrypted, Atom will encrypt it automatically before login.
You also have the login()
function. Unlike the attempt()
function, the login()
function takes as argument a model of the type defined in the configuration. So, in example you have this:
Both functions will return true if the login was successful and false otherwise.
Authentication Check
You will surely need to check if a user is connected. You can do this with the check()
function. the function will return true if there is a logged user and false otherwise.
Dernière mise à jour
Cet article vous a-t-il été utile ?