I'll show you how to make a Bootstrap 5 Auth Scaffolding in Laravel 9 in this tutorial. Auth Scaffolding uses the Laravel UI package to create a user registration, login, dashboard, logout, reset password, and email verification.
Let's get started on Laravel 9 Boostrap 5 Auth Scaffolding right away.
Table of Contents
- Install Laravel 9 App
- Install Laravel UI Package
- Install Bootstrap 5 Auth Scaffolding
- Install and Run NPM Packages
- Configuration Database Credentials
- Migrate Tables to Database
- Run Laravel Development Server
Install Laravel 9 App
Navigate to the directory where you wish to install the Laravel 9 application in the terminal or command line. On my desktop, I preferred the workspace directory.
cd desktop\workspace
Using the command below, install the most recent Laravel 9 version called Laravel9Auth.
composer create-project --prefer-dist laravel/laravel Laravel9Auth
Install Laravel UI Package
In the next step, I'll update the directory to the Laravel9Auth location.
cd Laravel9Auth
and then use the following command to install the Laravel UI package before building Auth Scaffolding.
composer require laravel/ui
Install Bootstrap 5 Auth Scaffolding
In this stage, I'll install Boostrap 5 Auth Scaffolding by running the script below.
php artisan ui bootstrap --auth
Install and Run NPM Packages
I've successfully constructed auth scaffolding, so let's install and start NPM using the commands below.
npm install
If you do not have Node.js installed on your machine, you will be unable to run npm commands. If you don't already have it, go to the official Node.js website and download and install it.
It will take some time to completely install node modules on your Laravel 9 application; once node modules are installed, launch the NPM Dev using the following command.
npm run dev
If it asks you to run npm run dev twice, follow the instructions and run npm run dev again.
And if you're using a MAC or Linux, you may run both at the same time, as shown below.
npm install && npm run dev
Configuration Database Credentials
The most critical step is to configure your Laravel 9 app's database credentials. Navigate to your application's root directory, locate the .env file, and enter your database credentials as seen below.
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=your_db_name
DB_USERNAME=your_db_username
DB_PASSWORD=your_db_password
Check that MySQL or MariaDB is already installed on your PC, in addition to PHP. If you do not already have MySQL/MariaDB, you can install it using XAMPP.
I've written a separate article on how to install XAMPP, which includes PHP, MariaDB, and Apache; simply follow the steps to install XAMPP on Windows 10/11.
Now that we've installed MariaDB, make sure your database is up and running before running the database migration command.
Migrate Tables to Database
Now, use the following command to migrate Laravel 9's default tables into your database.
php artisan migrate
Run Laravel Development Server
You have now completed all of the steps required to develop Laravel 9 Bootstrap 5 Auth Scaffolding. It is now time to start the development server and test the application with the command below.
php artisan serve