You might have noticed after installing a fresh Laravel 6 application that the
make:auth command no longer exists. We’ve received lots of messages and emails about this very issue, so I thought I’d write up a quick tutorial on generating auth scaffolding in Laravel 6.
First off, you can find everything you need to know in the Laravel 6 Authentication documentation. If you want a quick walkthrough, here goes nothing.
Laravel UI is a new first-party package that extracts the UI portion of a Laravel project into a separate laravel/ui package. The separate package enables the Laravel team to iterate on the UI package separately from the main Laravel codebase.
You can install the
laravel/ui package via composer:
laravel new my-app composer require laravel/ui
Once you’ve installed
laravel/ui you have a couple of commands available to generate UI code, including authorization.
If you intend to use Vue, React, or Bootstrap, the UI package provides the following command:
php artisan ui --help
Here are a few examples:
php artisan ui vue php artisan ui react
If you want to generate the auth scaffolding at the same time:
php artisan ui vue --auth php artisan ui react --auth
The ui:auth Command
Besides the new
ui command, the
laravel/ui package comes with another command for generating the auth scaffolding:
php artisan ui:auth
If you run the
ui:auth command, it will generate the auth routes, a
HomeController, auth views, and a
app.blade.php layout file.
You can also generate the views only with:
php artisan ui:auth --views
The other cool thing here is that the console command will prompt you to confirm overwriting auth files if you’ve already run the command before.
To learn more about the authentication and new UI package, check out the official Authentication Documentation.Filed in: News / Authentication
Join 31,000+ others and never miss out on new tips, tutorials, and more.