Laravel 8 Login and Registration System Tutorial | User Authentication

Laravel 8 authentication tutorial | Login and Register in Laravel 8


In this article, you will be learning how to make login and registration system in laravel 8 by artisan command.

Step 1: Let's install Laravel 8 as we have seen how to install laravel 8 on this link: Click here

Step 2: Let's setup the Laravel File .

1st : (dot) .env file for database connection:

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=database_name
DB_USERNAME=root
DB_PASSWORD=

2nd : Go to path : app/Providers/AppServiceProvider.php file and add the below code inside boot function to make all your database schema default string length value to 191 values.

use Illuminate\Support\Facades\Schema;

public function boot()
{
    Schema::defaultStringLength(191);
}

Step 3: Now lets give the below command to generate the Auth Login and Register system in laravel 8.

First, Install you laravel/ui  as follows:

$ composer require laravel/ui

after successfull installation of laravel/ui.

Install the laravel ui:auth by below command:

$ php artisan ui:auth

Note: (It only installs your Login and Registration System without any 3rd application like Vue, React, or Bootstrap.)

after your ui:auth Authentication Scaffoldings generated successfully, Lets Migrate the table from laravel application to our database by below command:

$ php artisan migrate

after successful migration into our database. lets start to serve the application by following command:

$ php artisan serve

We have successfully done with Login and Registration functionality in Laravel 8.

lets start at http://localhost:8000/login

Step 4: If you had seen your Login and Register FORM it would be without any CSS or Bootstrap design guys so, to solve that you have to add or install Bootstrap in our laravel 8 application guys as shown below:

Open file: resources/views/layouts/app.blade.php file.

add the CSS link in head tag

<head>

    <!-- Styles -->
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.1/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-+0n0xVW2eSR5OomGNYDnhzAbDsOXxcvSN1TPprVMTNDbiYZCxYbOOl7+AMvyTG2x" crossorigin="anonymous">

</head>

add the SCRIPT links before ending of the BODY tag.

<script src="https://code.jquery.com/jquery-3.6.0.min.js" integrity="sha256-/xUj+3OJU5yExlq6GSYGSHk7tPXikynS7ogEvDej/m4=" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.1/dist/js/bootstrap.bundle.min.js" integrity="sha384-gtEjrD/SeCtmISkJkNUaaKMoLD0//ElJ19smozuHV6z3Iehds+3Ulb9Bn9Plx0x4" crossorigin="anonymous"></script>

Now, the Login and register form is designed successfully using Boostrap 5.


Thanks for reading...