Laravel Artisan Generator Command: The make:auth Command

December 7, 2016 —John Koster

The make:auth command can be used to generate login and registration views, a basic HomeController controller and routes that can be used for basic authentication tasks. It accepts the optional flag --views which can be used to only generate the view files. The following views will be created (all paths are relative to the applications resources/views directory):

  • auth/login.blade.php
  • auth/register.blade.php
  • auth/passwords/email.blade.php
  • auth/passwords/reset.blade.php
  • auth/emails/password.blade.php
  • layouts/app.blade.php
  • home.blade.php
  • welcome.blade.php

The following controller file will also be created:

  • app/Http/Controllers/HomeController.php

The following entry will also be added to the app/Http/routes.php routes file:

1Route::group(['middleware' => 'web'], function () {
2 Route::auth();
3 
4 Route::get('/home', 'HomeController@index');
5});

Running this command will overwrite any changes made to any view or controller files with the same name. Running this command multiple times will also create multiple the HomeController route entries.

The following examples demonstrate how to call the make:auth command:

1# Run the command with default options.
2php artisan make:auth
3 
4# Only generate authentication views.
5php artisan make:auth --views

Some absolutely amazing
people

The following amazing people help support this site and my open source projects ♥️
If you're interesting in supporting my work and want to show up on this list, check out my GitHub Sponsors Profile.