How to Use Laravel UI Authentication in Laravel 10

In this tutorial, you will learn how to install authentication using Laravel UI in Laravel 10. If you want to use Bootstrap 5 in Laravel 10, you should use Laravel UI.

Step 1: Set Up Laravel Project

To install a fresh new Laravel application, navigate to your terminal, type the command, and create a new Laravel app.

composer create-project laravel/laravel inertia-vue

Now, you need to connect the Laravel app to the database. Open the .env configuration file and add the database credentials as suggested below.

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=database_name
DB_USERNAME=database_user_name
DB_PASSWORD=database_password

Step 2: Install Laravel UI

Install laravel ui via composer in laravel 10.

composer require laravel/ui

Step 3: Step up Auth Scaffolding

use anyone for you requirements.

// Generate basic scaffolding...
php artisan ui bootstrap
php artisan ui vue
php artisan ui react

// Generate login / registration scaffolding...
php artisan ui bootstrap --auth
php artisan ui vue --auth
php artisan ui react --auth

Step 4: Run npm install && npm run dev command

Next, you need to install npm and then run the Vite server.

npm install && npm run dev

Step 5: Migrate Your database

Next, run this command.

php artisan migrate

Step 6: Run Laravel Server

Now our Laravel 10 authentication system is ready. you can run serve.

php artisan serve