Laravel Authentication: Authentication Quickstart

Routing

Php artisan make:auth

Views

php artisan make:auth

Authenticating

Retrieving The Authenticated User

Use Illuminate\Support\Facades\Auth;

// Get the currently authenticated user...
$user = Auth::user();

// Get the currently authenticated user's ID...
$id = Auth::id();
<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;

class ProfileController extends Controller
{
    /**
     * Update the user's profile.
     *
     * @param  Request  $request
     * @return Response
     */
    public function update(Request $request)
    {
        // $request->user() returns an instance of the authenticated user...
    }
}

Protecting Routes

Route::get('profile', function () {
    // Only authenticated users may enter...
})->middleware('auth');
Public function __construct()
{
    $this->middleware('auth');
}

Login Throttling

Is unique to the user's username / e-mail address and their IP address.

Laravel Authentication: Authentication Quickstart — Structure map

Clickable & Draggable!

Laravel Authentication: Authentication Quickstart — Related pages: