1. Laravel provides an inbuilt facility for creating basic authentication system.
2. Laravel makes authentication implementation very straightforward.
3. Laravel's authentication facilities are made up of "guards" and "providers".
Guards define how users are authenticated for each request.
Providers define how users are retrieved from your persistent storage.
Here’s the steps to create a simple authentication system in any Laravel Project.
1. Create Project using the command below(<blog> is project name) :
Install via Composer
composer create-project --prefer-dist laravel/laravel blog
After installation go to your project directory, here named “blog”:
php artisan serve
It will start a development server. Go to that link and you are able to access the basic home page for that project.
2. After this simple installation go through this link for migration and environment related information which are necessary for the next step.
In .evn file set basic database configuration.
3. Navigate to your Laravel project directory via terminal then use the below command :
php artisan make:auth
Note : This command should be used on fresh applications and will install a layout view, registration and login view, as well as routes for all authentication end-points. A HomeController will also generated to handle post-login requests to your application’s dashboard.
4. Run the migrations :
php artisan migrate
5. After successful execution of above command just refresh the home page and we are able to see “Register” & “Login” menu in the header section(Right side).
6. Register yourself by clicking on “Register” menu.
7. After Registration you will automatically logged in.
8. Please Logout yourself & login again for checking whether the login functionality is working or not.
After Login successfully :
These are the steps to implement Laravel Authentication module provided by Laravel itself. Its an easy and convenient way to design an authentication system for Laravel framework.