Authentication Quickstart: Protecting Routes

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

Redirecting Unauthenticated Users

/**
 * Get the path the user should be redirected to.
 *
 * @param  \Illuminate\Http\Request  $request
 * @return string
 */
protected function redirectTo($request)
{
    return route('login');
}

Specifying A Guard

Public function __construct()
{
    $this->middleware('auth:api');
}

Authentication Quickstart: Protecting Routes — Structure map

Clickable & Draggable!

Authentication Quickstart: Protecting Routes — Related pages: