Home Laravel How to create authentication in Laravel ?

How to create authentication in Laravel ?

by Shahriar Sagor
authentication  in Laravel

Today now in this post i will show you How to create authentication in Laravel ? We are always need to implement authentication system in our project. Here i mean that sign-in, sign-out, sign-up and forgot password for our project. If we work on core PHP, or any other PHP framework then it will take a long time and need large amount code as well to make any auth module for our application.

But in Laravel application provide us simple way to create an authentication module in our laravel application. In Laravel application provide us several php artisan command, on that command through we can generate an authentication module easily.

Laravel 8 also will create a new auth route and also blade file, on that way we can also customize our auth system.

At First, we haven’t installed fresh laravel application then we can get from run the bellow command:

composer create-project --prefer-dist laravel/laravel blog

Now we can run the bellow command for create an automatically authentication system:

php artisan make:auth

After this command will need to updated our route file as like as bellow route:

Route::get('/', function () {
 return view('welcome');
});
Route::group(['middleware' => 'web'], function () {
    Route::auth();
    Route::get('/home', 'HomeController@index');
});

we can also find the HomeController in our Controller Directory.

php artisan command through we will also find the several blade file by using bootstrap layout as like as bellow:

/resources/views/auth/login.blade.php
/resources/views/auth/register.blade.php
/resources/views/auth/passwords/email.blade.php
/resources/views/auth/passwords/reset.blade.php
/resources/views/auth/emails/password.blade.php
/resources/views/layouts/app.blade.php
/resources/views/home.blade.php
/resources/views/welcome.blade.php

Read Also: How we can create virtual host in ubuntu apache?

Thanks for read. I hope it help you. For more you can follow us on facebook

close

You may also like