You might have descried after installing a fresh Laravel 7 application that the composition:auth command no longer subsists. We’ve received lots of messages and emails about this very issue, so I cerebrated I’d inscribe up an expeditious tutorial on engendering auth scaffolding in Laravel 7.
First off, you can find everything you require to ken in the Laravel 7 Authentication documentation. If you operate an expeditious walkthrough, here goes nothing.
Laravel UI
Laravel UI is an incipient 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 discretely from the main Laravel codebase.
You can install the laravel/ui
package via composer:
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.