Authentication
In Laravel 5.4 and above, you can install a full-featured authentication scaffold.
Install Authentication Scaffold
Enter this on the command line:
php artisan make:auth
What This Does
This will do the following:
- Creates an /auth subdirectory under /views, which contains the following subdirectories and view template files:
∟auth∟passwordsemail.blade.phpreset.blade.phplogin.blade.phpregister.blade.phpverify.blade.php
- Creates a /layouts subdirectory under /views, which contains an app.blade.php view template file:
- Creates two new view template files under /views:
- home.blade.php
- welcome.blade.php (this overwrites the welcome.blade.php file that comes with the base installation)
- Installs a
HomeController, with:- an
index()method that returns thehomeview - a constructor method that calls
$this->middleware('auth').
- an
- Adds the following to your routes file:
Auth::routes();Route::get('/home', 'HomeController@index')->name('home');
NOTE: The following authentication-related classes come with the base Laravel installation, and exist even before you run php artisan make:auth:
App/Http/Controllers/Auth/ForgotPasswordController.phpApp/Http/Controllers/Auth/LoginController.phpApp/Http/Controllers/Auth/RegisterController.phpApp/Http/Controllers/Auth/ResetPasswordController.phpApp/Http/Controllers/Auth/VerificationController.phpApp/Http/Middleware/RedirectIfAuthenticated.phpApp/Providers/AuthServiceProvider.php