phpicoder Dec 17, 2021 laravel

Hello Developer, In this tutorial, we will learn login and registration tutorial in laravel 8 web applications. Some modifications have been made in the auth module such as first requiring leravel/ui and then running auth command.

This tutorial will give you simple example of laravel 8 login and registration authentication using --auth and this is a new laravel login and registration authentication So, let's follow few step to create tutorial of laravel login and registration authentication.

Step 1: Install Laravel

Open the terminal and run the following command 

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

Step 2: Database Connection

Go to inside the application, we have a .env file, so open .env file and edit following code

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=laravel8
DB_USERNAME=root
DB_PASSWORD=*********

Step 3: Create Database Table

Now if you need table then use following command and create db table.

php artisan migrate

The above command has created a default table inside the database.

Step 4: Install Laravel ui

Laravel 8 have a new features for ui. So first requiring leravel/ui

Open the terminal and cd laravel8auth and then run the following command.

composer require laravel/ui

Step 5: Install Laravel auth

Now after installing laravel/ui we need to install laravel auth commnad so run the following command.

php artisan ui:auth

after install ui:auth commnad we have a 2 things.

1 Things If you are using npm then follow the following two command

npm install
npm run dev

2 Things if you are not using npm

then go to resources/views/layouts path and open app.blade.php file and add bootstrap cdn file under head tag So edit the head tag following code.

<!doctype html>
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <!-- CSRF Token -->
    <meta name="csrf-token" content="{{ csrf_token() }}">

    <title>{{ config('app.name', 'Laravel') }}</title>

    <!-- Fonts -->
    <link rel="dns-prefetch" href="//fonts.gstatic.com">
    <link href="https://fonts.googleapis.com/css?family=Nunito" rel="stylesheet">

    <!-- Styles -->
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">
</head>

Step 6: Run Laravel App

Start the laravel application with following command: 

php artisan serve

After run above command we have a http://127.0.0.1:8000 url and this is a root url.

I hope it can help you...