Laravel changes in php artisan ui:auth php artisan make:auth

rollback undo effects of php artisan ui:auth php artisan make:auth

Panjeh
5 min readNov 24, 2019

Sometimes you need to figure out what happens behind the scene when running Laravel auth scaffolding commands.

Note: First, I deal with Larvel 5.8 and older versions as the base and then compare changes with Laravel 6 using different commands of ui:auth.

Before you continue with the rest of this tutorial, I would like to introduce two packages for Laravel that I have recently developed: Laravel Pay Pocket, a modern multi-wallet package, and Laravel Failed Jobs, a UI for the Laravel Failed Jobs Table. I hope they may be of help to you.

https://github.com/HPWebdeveloper/laravel-pay-pocket
https://github.com/HPWebdeveloper/laravel-failed-jobs

I: Laravel 5.8 and older

In old version of Laravel after doing

php artisan make:auth

Some changes happen as the following screenshot.

How these changes actually happen? Do you want to know? You should read the core command file in this path:

vendor/laravel/framework/src/Illuminate/Auth/Console/AuthMakeCommand.php

only in routes/web.php some lines is added as follow:

In order to Rollback them you should delete the created routes by removing these two lines.

and also some class files are created as follow that you should consider.

Controller file

  • app/Http/Controllers/HomeController.php

View Files

I: Login, Register, Getting Verification Email

  • resources/views/auth/login.blade.php
  • resources/views/auth/register.blade.php
  • resources/views/auth/verify.blade.php

II: Password

  • resources/views/auth/passwords/email.blade.php
  • resources/views/auth/passwords/reset.blade.php

III: Home and main app layout

  • resources/views/home.blade.php
  • resources/views/layouts/app.blade.php

II: Laravel 6:

As you now in Laravel 6, refer here , there are some commands for auth scaffolding:

laravel new project --auth----php artisan ui:auth --viewsphp artisan ui:auth----php artisan ui bootstrap --auth
php artisan ui vue --auth
php artisan ui react --auth

I want to show you changes happen in each command one by one.

If you want to know the changes happen you should have a look at AuthCommand.php file in this path after installing laravel/ui:

vendor/laravel/ui/src/AuthCommand.php

Part 0 — Laravel 6 — Auth Scaffolding Shorthand

If you update laravel/installer to v2.3.0 you can do:

How to update laravel/installer : read here

laravel new my-test-app --auth

Which is the shorthand of four following commands:

Laravel new my-test-appcd my-test-appcomposer require laravel/ui --devphp artisan ui vue --auth

To initialize the Laravel project you need to:

php artisan migratenpm install
npm run dev

Part 1— Laravel 6 —Only make view files

After doing:

Laravel new my-test-appcomposer require laravel/ui --dev

You can generate the auth views only with:

php artisan ui:auth --views

Some changes happen as follow:

As you see there is no changes in web.php since the command is not responsible for making routes and controller.

And also one new file is created more than what happens in Larvel 5.8 and older as follow:

View File

Password

  • resources/views/auth/passwords/confirm.blade.php

Part 2 — Laravel 6 — ui:auth

After doing:

php artisan ui:auth

Some changes happen as follow:

Lets check the changes in

  • web.php : the changes is the same as in Laravel 5.8 and older

And also one new file is created more than what happens in Part 1 — Laravel 6 — Only make view files is created as follow:

Controller file

  • app/Http/Controllers/HomeController.php

Part 3 - Laravel 6 — bootstrap

After doing:

php artisan ui bootstrap --auth

Some changes happen as follow:

Lets check the changes in

  • package.json
  • bootstrap.js
  • app.css
  • web.php : the changes is the same as in Laravel 5.8 and older

And also one new file is created more than what happens in Part 2 — Laravel 6 — ui:auth are created as follow:

SCSS file

  • resources/sass/_variables.scss

Attention:

If you do only this:

php artisan ui bootstrap

You will see this changes only without any auth scaffolding:

Part 4 — Laravel 6 — vue

After doing:

php artisan ui vue --auth

Some changes happen as follow:

Lets check the changes in

  • package.json
  • app.js
  • bootstrap.js : the changes is the same as Part 3 — Laravel 6 — bootstrap
  • app.css : the changes is the same as Part 3 — Laravel 6 — bootstrap
  • web.php: the changes is the same as Part 3 — Laravel 6 — bootstrap
  • webpack.mix.js has not changed and only a space is removed

And also one new file is created more than what happens in Part 3 — Laravel 6 — bootstrap is created as follow:

js file

  • resources/js/components/ExampleComponent.vue

Attention:

If you do only this:

php artisan ui vue

You will see this changes only without any auth scaffolding:

--

--