lundi 14 novembre 2016

Passing variable to middleware in laravel 5.x

I would like to send a VARIABLE to my middleware in laravel ,the way I tried is this

Route::get('projects/{id}','projectsController@index')->middleware(['auth', 'project:{id}']);

But all I get in the middleware handle function is '{id}' where as I want the value of the id variable

public function handle($request, Closure $next,$pid)
{
    dd($pid);
    return $next($request);
}

I read the documentation on middleware for the version of laravel I am using i.e. 5.2 http://ift.tt/2g92FJ3

But the example given there only talks about passing plain strings as parameters



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire