DEV Community

itstuffsolutions
itstuffsolutions

Posted on • Originally published at itstuffsolutiotions.io

Laravel 12 Bootstrap Auth Scaffolding Tutorial Step by Step

In this laravel tutorial , you will learn how to set up Laravel 12 Bootstrap Auth Scaffolding Tutorial Step by Step using the official Laravel UI package. This method is well-suited for developers who choose Bootstrap over Tailwind, Jetstream, or Breeze. For complete instructions and more details, check out the official Laravel documentation here.

What is Laravel UI?

Laravel UI provides basic authentication scaffolding for the Laravel frontend. It offers basic login and registration functionality using your choice of frontend (Bootstrap, Vue, or React). While Laravel Breeze and Jetstream are more modern, Laravel UI is great for those who want lightweight and Bootstrap-based auth scaffolding.

Steps For Laravel 12 Bootstrap Auth Scaffolding

  • Step 1: Install Laravel 12 Project
  • Step 2: Install Laravel UI Package
  • Step 3: Run Migrations
  • Step 4: Test Authentication Flow

Step 1: Install Laravel 12 Project

First, create a new Laravel project using Composer, you can skip this step if you have already installed Laravel 12 project, run the following command given below:

composer create-project laravel/laravel laravel-bootstrap-auth

Enter fullscreen mode Exit fullscreen mode

move into your project folder:

cd laravel-bootstrap-auth

Enter fullscreen mode Exit fullscreen mode

Step 2: Install Laravel UI Package

Laravel has removed the default Bootstrap authentication scaffolding, so we need to set it up manually. Run the given command below to install laravel ui package.

composer require laravel/ui
Enter fullscreen mode Exit fullscreen mode

Now that the Laravel UI package has been successfully installed, you can generate the Bootstrap UI along with authentication scaffolding by running the following Artisan command:

php artisan ui bootstrap --auth
Enter fullscreen mode Exit fullscreen mode

This will create: Authentication routes (login, register, password reset), Auth controllers, Blade views using Bootstrap, Layout file for frontend.

To load Bootstrap and related frontend resources, run:

npm install
npm run dev

Enter fullscreen mode Exit fullscreen mode

This will compile all the necessary JS and CSS files using Laravel Mix.

Step 3: Run Migrations

Now set up the database in .env file, then run:

php artisan migrate
Enter fullscreen mode Exit fullscreen mode

This will create the default users table and other auth-related tables.

Read Full Tutorial: Laravel 12 Bootstrap Auth Scaffolding Tutorial Step by Step

Top comments (0)