Send route param to middleware as argument Laravel

2019-07-16 00:49发布

问题:

Can I sent to middleware parameter from router as argument?

For simple:

Route::get('test/{param}',['middleware'=>['testing:{param}'],'uses'=>'TestController@method']);

Is there in Laravel isset method like this? I know about Route::current()->parameters() but I want to find better method.

回答1:

I ask Laravel's team on GitHub about it. They answered that now any method like this not exists. They answer that I should use $request->route().

Enjoy!