Laravel 9 login and registration tutorial

Hello Developer, In this tutorial, we will learn login and registration tutorial in laravel 9 web applications. Login and registration is a basic part of the web app so it is very important to explain it. For this we need to follow the steps below.

We know that Laravel Framework is the best PHP framework due to these advanced features and development tools that help speed up your development; And again, this would mean that it is more Secure than the core.

This tutorial will give you a simple and understandable example of laravel 9 login and registration authentication using --auth and this is a new laravel login and registration authentication.

Step 1: Install Laravel

Open the terminal and run the following command 

composer create-project laravel/laravel laravel9auth

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

ow 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...