Running make:auth in Laravel 6

News

September 6th, 2019

artisan-ui-auth.png

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

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:

1laravel new my-app
2composer 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:

1php artisan ui --help

Here are a few examples:

1php artisan ui vue
2php artisan ui react

If you want to generate the auth scaffolding at the same time:

1php artisan ui vue --auth
2php 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:

1php 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:

1php 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.

Learn More

To learn more about the authentication and new UI package, check out the official Authentication Documentation.

Filed in:

Paul Redmond

Full stack web developer. Author of Lumen Programming Guide and Docker for PHP Developers.