Create UI Auth Scaffolding Using Bootstrap in Laravel 9


Install UI Auth Package in Laravel 9

Open the terminal and hit the below command.

composer require laravel/ui

It will take a couple of seconds to install.

Once the installation is completed, you will have to add the authentication scaffolding. 


Add Bootstrap Auth Scaffolding in Laravel

Stay ahead to the terminal and hit the below command. Here, we are going to install Bootstrap auth scaffolding. Laravel provides other options as well like – React and Vue auth. We will see it in other posts.

php artisan ui bootstrap --auth

This auth system requires some UI dependencies. So, in order to install that, you have to hit the below command.

npm install && npm run dev
npm run build

It will generate some CSS and JS files for the auth scaffolding. Let it be completed. On the success of the build, it will generate the CSS and JS files.

Configure Email For Sending Password Reset Link

For sending a password reset link email, you have to add the email configuration. So, look at the .env file and add these credentials.

MAIL_MAILER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
MAIL_USERNAME={{YOUR_MAIL_USERNAME}}
MAIL_PASSWORD={{YOUR_MAIL_PASSWORD}}
MAIL_ENCRYPTION=tls
MAIL_FROM_ADDRESS={{FROM_ADDRESS}}
MAIL_FROM_NAME="${APP_NAME}"

After adding the email configuration, you will be able to trigger an email for the password reset link.

Conclusion

We covered the Bootstrap UI auth in Laravel 9. Using the auth scaffolding we have the Register, login, and Password Reset link functionalities. You can customize the design of the forms and enhance the functionalities as well. That’s it for this post.


អត្ថបទបន្ទាប់ អត្ថបទមុន