loading...

Basic Laravel Login and Registration using Laravel Breeze

kingsconsult profile image Kingsconsult Updated on ・3 min read

Hello, How are you doing, I want to introduce Laravel Breeze to you, in the course of the week Taylor Otwell (creator of Laravel) tweeted about a new package released (Laravel Breeze). Taylor Tweet This is because of the uproar about Jetstream where some thought that Laravel have abandoned their legacy UI, but Taylor cleared the air on that, and have to release another package that is not complicated like the Jetstream and in which one can customize to his/her desire.
This comes with basic Authentication like, User registration and user Login, change of password, email setup, send email for change of password, tailwind and blade etc. Let's create our first app with Laravel breeze.

If you prefer to watch videos, this is the video Youtube Video link

Click on my profile to follow me to get more updates.

Step 1: Install a new Laravel app

You can use

laravel new breeze

laravel new breeze laravel new breeze
but in using this, you must make sure laravel is installed on your system, you can install laravel globally using

composer global require laravel/installer

or you can install laravel using composer without Laravel using

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

composer create-project composer create-project

Step 2: Require Laravel Breeze

After installing Laravel, then change into the directory cd breeze/ and require Laravel Breeze with composer using the command below

composer require laravel/breeze --dev

require breeze

Step 3: Install Laravel Breeze

php artisan breeze:install

install breeze

Step 4: Install the JavaScript pacakges

After installing Laravel Breeze, it will prompt you to run

npm install && npm run dev

Step 5: Setup Database

Open your .env file that was created and you will see that the name of the project has automatically be entered as the database name, you can change it to the name of the database you want to use, or you leave it and create a new database with the name
.env

Step 6: Run migration

After setting up our database and editing it in the .env file, we need to run the migration, but before that, we need to set the default string length, if not, this will throw errors in the course of migrations.
Go to app/Providers/AppServiceProvider.php and add the schema for the default string length in the boot method.

Schema::defaultstringLength(191);

remember to call the schema class at the top

use Illuminate\Support\Facades\Schema;

<?php

namespace App\Providers;

use Illuminate\Support\ServiceProvider;
use Illuminate\Support\Facades\Schema;


class AppServiceProvider extends ServiceProvider
{
    /**
     * Register any application services.
     *
     * @return void
     */
    public function register()
    {
        //
    }

    /**
     * Bootstrap any application services.
     *
     * @return void
     */
    public function boot()
    {
        Schema::defaultstringLength(191);
    }
}
Enter fullscreen mode Exit fullscreen mode

then run the migration

php artisan migrate

migrate

Step 7: Add your email login details

This is so we can be able to reset our password and other email features
email settings

Step 8: Start the App

php artisan serve

http://127.0.0.1:8000/
home page
http://127.0.0.1:8000/register
register
http://127.0.0.1:8000/dashboard
dashboard
http://127.0.0.1:8000/login
dashboard
Now you have your basic laravel app with Auth setup.
Follow me for more of my articles, you can leave comments, suggestions, and reactions.
I am open to any vacancy as a PHP backend engineer, my strength is in the Laravel framework

Watch the video on Youtube
click the link to view my profile and follow me

Discussion

pic
Editor guide