鉴于以下路线,它将响应
http://example.com/game/stats/123
http://example.com/game/stats/game/123
http://example.com/game/stats/reviewer/123
我想知道的是,我怎样才能让它响应
http://example.com/game/123/stats
http://example.com/game/123/stats/game
http://example.com/game/123/stats/reviewer
我试着做
Route::group(['prefix' => 'game/{game}'], function($game){
但这失败了“缺少 {closure}() 的参数 1”
请注意,除了统计数据之外还有其他四个组,但为了简洁起见,我在此示例中省略了它们。
Route::group(['prefix' => 'game'], function(){
Route::group(['prefix' => 'stats'], function(){
Route::get('/{game}', ['as' => 'game.stats', function ($game) {
return View::make('competitions.game.allstats');
}]);
Route::get('game/{game}', ['as' => 'game.stats.game', function ($game) {
return View::make('competitions.game.gamestats');
}]);
Route::get('reviewer/{game}', ['as' => 'game.stats.reviewer', function ($game) {
return View::make('competitions.game.reviewstats');
}]);
});
});