How to create authentication(login and registration) in Laravel 5.2?

By Hardik Savani November 5, 2023 Category : Laravel

We always wanted to do authentication system in your project, i mean sign-in, sign-out, sign-up and forgot password for our project. If you work on core PHP, or any PHP framework then it will take long time and large amount code as well to make auth module for your application.

But Laravel 5.2 provide simple way to create authentication module in your laravel application. Laravel 5.2 provide several php artisan command, that command through we can generate authentication module easily.

Laravel 5.2 also will create new auth route and blade file, that way you can also customize your auth module.

First, you haven't installed fresh laravel 5.2 then you can get from bellow command:

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

Now you can run bellow command for create automatically authentication system:

php artisan make:auth

Output:

After this command will had updated your route file as bellow route:

Route::get('/', function () {

return view('welcome');

});

Route::group(['middleware' => 'web'], function () {

Route::auth();

Route::get('/home', 'HomeController@index');

});

You can also find HomeController in your Controller Directory.

php artisan command through you will also find several blade file using bootstrap layout 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

So, let's try to do this way and check in your project, just run '/' URL.....

Shares