Laravel - Authentication is the process of identifying the user credentials. In web applications, authentication is managed by sessions which take the input parameters such as email or username and password, for user identification. If these parameters match, the user is said to be authenticated.
Laravel uses the following command to create forms and the associated controllers to perform authentication −
php artisan make:auth
This command helps in creating authentication scaffolding successfully, as shown in the following screenshot −
The controller which is used for the authentication process is HomeController.
middleware('auth'); } /** * Show the application dashboard. * * @return IlluminateHttpResponse */ public function index() { return view('home'); } }
As a result, the scaffold application generated creates the login page and the registration page for performing authentication. They are as shown below −
Laravel uses the Auth façade which helps in manually authenticating the users. It includes the attempt method to verify their email and password.
Consider the following lines of code for LoginController which includes all the functions for authentication −
$email, 'password' => $password])) { // Laravel - Authentication passed... return redirect()->intended('dashboard'); } } }
The above is the detailed content of Laravel - Authentication. For more information, please follow other related articles on the PHP Chinese website!