O'Reilly logo

Mastering Laravel by Christopher John Pecoraro

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Route middleware unravelled

Two route-based middleware classes are present in Laravel 5 in app/Http/Middleware/. One of these classes is named Authenticate. It provides basic authentication and uses a contract.

In reference to routes, the middleware sits between the route and the controller:

Route middleware unravelled

Default middleware – the Authenticate class

A class called Authenticate.php has the following code:

<?php namespace MyCompany\Http\Middleware; use Closure; use Illuminate\Contracts\Auth\Guard; class Authenticate { /** * The Guard implementation. * * @var Guard */ protected $auth; /** * Create a new filter instance. * * @param Guard $auth * @return void */ public ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required