Route::get('home', 'HomeController@index');
Route::get('home/{menu_slug}', 'HomeController@showMenuContents');
Route::get('home/{menu_slug}/{submenu_slug}', 'HomeController@showSubmenuContents');
我是拉拉维尔的初学者,事实上我昨天开始了。我听说过筑巢路线。我也看过其他的筑巢路线和laravel文档,但我发现它们很混乱。如何在上述路线上实施。
答案 0 :(得分:2)
您可以对路线进行分组
Route::group(['prefix' => 'home'], function()
{
Route::get('/', 'HomeController@index');
Route::get('/{menu_slug}', 'HomeController@showMenuContents');
Route::get('/{menu_slug}/{submenu_slug}', 'HomeController@showSubmenuContents');
}
答案 1 :(得分:0)
你必须使用
Route::group(['prefix' => 'home'], function()
{
Route::get('/{menu_slug}/{submenu_slug}', 'HomeController@showSubmenuContents');
Route::get('/{menu_slug}', 'HomeController@showMenuContents');
Route::get('/', 'HomeController@index');
}