mardi 1 décembre 2015

How to pass captured parameter in route to middleware?

If I have middleware like:

<?php namespace App\Http\Middleware;

class SomeMiddleware
{
    public function handle($request, Closure $next, $id = null)
    {
        //
    }
}

In kernel.php:

'someMiddleware'    => \App\Http\Middleware\SomeMiddleware::class,

In routes.php :

Route::put('post/{id}', ['middleware' => 'someMiddleware']);

How I can pass id captured in {id} to my middleware? I know that I can pass some custom parameter like this:

Route::put('post/{id}', ['middleware' => 'someMiddleware:16']);

But in laravel documentation there is no described how to pass argument captured in route pattern.



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/1Qb1CRZ
via IFTTT

Aucun commentaire:

Enregistrer un commentaire