Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[5.0] Allow route middlewares to be grouped together#7487

Merged
taylorotwell merged 1 commit into
laravel:5.0from
winglian:routemiddlewares-l5
Feb 23, 2015
Merged

[5.0] Allow route middlewares to be grouped together#7487
taylorotwell merged 1 commit into
laravel:5.0from
winglian:routemiddlewares-l5

Conversation

@winglian
Copy link
Copy Markdown
Contributor

This will allow multiple middlewares to be packaged together under a single identifier. For example, if I wanted to move Illuminate\Session\Middleware\StartSession and Illuminate\View\Middleware\ShareErrorsFromSession from the global middlewares to the route middlewares, but keep them together so only routes that need sessions would only need to reference a single middleware.

    Route::group(['middleware' => ['session']], function() {
        // ...
    });
    protected $routeMiddleware = [
        'auth' => 'App\Http\Middleware\Authenticate',
        'auth.basic' => 'App\Auth\Middleware\AuthenticateWithBasicAuth',
        'guest' => 'App\Http\Middleware\RedirectIfAuthenticated',
        'session' => [
            'Illuminate\Session\Middleware\StartSession',
            'Illuminate\View\Middleware\ShareErrorsFromSession',
        ]
    ];

@GrahamCampbell GrahamCampbell changed the title Allow route middlewares to be grouped together [5.0] Allow route middlewares to be grouped together Feb 19, 2015
taylorotwell added a commit that referenced this pull request Feb 23, 2015
[5.0] Allow route middlewares to be grouped together
@taylorotwell taylorotwell merged commit bfa96f5 into laravel:5.0 Feb 23, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants