Hi,
I'm trying to understand the rational of the following in the way that new Laravel apps are generated. Particularly the way the app code related to user registration, login, etc is generated.
When I create a new app with laravel new myapp, it creates many files including
app/Http/Controllers/Auth/AuthController.php
app/Http/Controllers/Auth/PasswordController.php
database/migrations/2014_10_12_000000_create_users_table.php
database/migrations/2014_10_12_100000_create_password_resets_table.php
app/User.php
The above files all seem like only a portion of a bigger system for user, registration, login, logout, password reset, etc.
In order to have the full system, I can run php artisan make:auth. This command modifies
app/Http/routes.php
resources/views/welcome.blade.php
and it creates
app/Http/Controllers/HomeController.php
resources/views/auth/emails/password.blade.php
resources/views/auth/login.blade.php
resources/views/auth/passwords/email.blade.php
resources/views/auth/passwords/reset.blade.php
resources/views/auth/register.blade.php
resources/views/home.blade.php
resources/views/layouts/app.blade.php
What the above means for the developer:
Currently, a developer who wants an "empty" app with nothing related to users, registration, etc needs to do the following
$ laravel new myapp
$ cd myapp
$ rm -rf app/Http/Controllers/Auth database/migrations/*.php app/User.php
Currently, a developer who wants an app with the full user, registration, etc system needs to do the following.
$ laravel new myapp
$ cd myapp
$ php artisan make:auth
So my question can be worded two ways
- Why does
laravel new myapp create any portion of the solution? Why doesn't it just create an "empty" app with nothing related to users, registration, etc and then leave the creation of all those files to php artisan make:auth? In this way, a developer who wants an app having nothing to do with users could run just laravel new myapp. A developer who wants an app with users could run laravel new myapp && cd myapp && php artisan make:auth or perhaps something like laravel new myapp --with-users.
or the other way to word my question is
- Why doesn't
laravel new myapp create the entire solution and then php artisan make:auth would not be necessary? (This is not handy for the developer wanting an "empty" app as they would have a lot to delete to get to the empty app.)
Thanks for sharing your insight.
Peter