1
我目前正在laravel 5.2的一个相当大的网站上工作,并且我想将选择的语言存储在路由中间件内,这可按预期工作。但是当我在组内设置一个路由控制器时,控制器得到两个变量而不是一个。语言和控制器的第二个变量,如下所示。 有什么办法只将一个变量传递给控制器而不是两个?将单个参数传递给路由组中的控制器laravel 5.2
//Routing:
Route::group(['prefix' => '{language}', 'middleware' => ['info']], function()
{
Route::get("template/{template}", '[email protected]');
}
//Example method in controller:
public function getTemplate($language, $template)
{
return response($template);
}
//What i want in the controller.
public function getTemplate($template)
{
return response($template);
}