Laravel 12 & Bootstrap 5: Auth Scaffolding Tutorial with Laravel UI Package
Laravel 12 makes authentication setup easy with the Laravel UI package. If you’re using Bootstrap 5 for styling, you can quickly scaffold authentication with a simple Artisan command.
Step 1: Install Laravel 12 & Follow this Link
Step 2: Install Laravel UI (https://github.com/laravel/ui)
composer require laravel/ui
Command to Generate Auth Scaffolding
To create authentication scaffolding with Bootstrap 5, run the following command in your Laravel 12 project:
php artisan ui bootstrap --auth
npm install && npm run dev
This will generate login, register, and password reset pages styled with Bootstrap 5.
Change in default DatabaseSeeder.php
<?php
namespace Database\Seeders;
use App\Models\User;
// use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;
class DatabaseSeeder extends Seeder
{
/**
* Seed the application's database.
*/
public function run(): void
{
// User::factory(10)->create();
User::factory()->create([
'name' => 'Admin',
'email' => 'admin@admin.com',
]);
}
}
Final Steps
After running the command, migrate your database:
php artisan migrate --seed
Preview Your Laravel 12 App in the Browser
Now, open your web browser, enter the provided URL, and check the app’s output:
composer run dev
You should now see your Laravel 12 app with Bootstrap 5 auth scaffolding in action! 🚀
Then, visit:
http://127.0.0.1:8000/login
Now, your Laravel 12 app is fully set up with Bootstrap 5 authentication scaffolding. 🚀
Did you know you can clap multiple times? 🥰 If this story added value to your day, please show your support by giving it a 👏 clap, sharing it with others, or even sponsoring my work. Your appreciation means the world to me!