Reference

Laravel Reference

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:

  1. Creates an /auth subdirectory under /views, which contains the following subdirectories and view template files:
∟auth
  ∟passwords
    email.blade.php
    reset.blade.php
  login.blade.php
  register.blade.php
  verify.blade.php
  1. Creates a /layouts subdirectory under /views, which contains an app.blade.php view template file:
  2. 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)
  3. Installs a HomeController, with:
    • an index() method that returns the home view
    • a constructor method that calls $this->middleware('auth').
  4. 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.php
  • App/Http/Controllers/Auth/LoginController.php
  • App/Http/Controllers/Auth/RegisterController.php
  • App/Http/Controllers/Auth/ResetPasswordController.php
  • App/Http/Controllers/Auth/VerificationController.php
  • App/Http/Middleware/RedirectIfAuthenticated.php
  • App/Providers/AuthServiceProvider.php

Next: Customize Laravel's Authentication Scaffold