how to use laravel ui authentication in laravel 10

In this tutorial you will see how to install authentication with laravel ui in laravel 10. If you want to use bootstrap 5 in laravel 10 then you should laravel UI.


Laravel 10 Authentication with Laravel UI

Step 1: Set Up Laravel Project

Step 2: Install Laravel UI

Step 3: Step up Auth Scaffolding

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

Step 5: Migrate Your Database

Step 6: Run Laravel Server


Step 1: Set Up Laravel Project

Installing a fresh new laravel application, so head over to the terminal, type the command, and create a new laravel app.

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

Now, you have to connect the laravel app to the database, hence open the .env configuration file and add the database credentials as suggested below.

.env

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 then run 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