Thursday, 1 October 2020

Laravel 6 and 7 Authentication

Laravel 6 and 7 Authentication

Laravel simplifies authentication implementation, providing robust, out-of-the-box support for common authentication tasks. Laravel 6 introduced Laravel UI, a separate package, to manage authentication scaffolding, whereas Laravel 7 continued to refine these features, ensuring a smoother developer experience.

Moreover make:auth command no longer exists in Laravel 6 and Laravel 7.So if we want to use laravel auth in laravel 6/7 applications then we need to use the Laravel UI package(laravel/ui).

1) Install Laravel UI (For laravel 6)

Use Composer to install the Laravel UI package and generate the auth scaffolding.


To install composer package laravel/ui run
composer require laravel/ui

After installing of above package, we will have a couple of new commands available.To see new commands run.
php artisan ui --help

ui:auth Command

To generate authentication views we need to run following artisan command.
php artisan ui:auth
It will generate 
  1. HomeController
  2. auth routes
  3. auth views( registration, forgot password, login, reset password views )
  4. app.blade.php
To generate only views in your existing application then you need to add --views.

For example:
php artisan ui:auth --views
For further details please visit official documentation:

No comments:

Post a Comment

Laravel csrf token mismatch for ajax post request

Error "CSRF Token Mismatch" commonly occurs if tokens do not match in both sessions and sent , and received requests.CSRF token he...