2014-01-26 118 views
0

我有一個路由組中的兩個路由控制器:加前綴的路由控制器

Route::group(array('before' => 'auth'), function() 
{ 
    Route::controller('dashboard/', 'DashboardController'); 
    Route::controller('dashboard/profile', 'DashboardProfileController'); 
}); 

這工作,直到我添加前綴鍵給數組:

Route::group(array('prefix' => 'dashboard', 'before' => 'auth'), function() 
{ 
    Route::controller('/', 'DashboardController'); 
    Route::controller('/profile', 'DashboardProfileController'); 
}); 

這很奇怪的第一路由控制器作品因爲我可以訪問localhost/dashboard但第二次失敗localhost/dashboard/profile和或localhost/dashboard/profile/edit

這裏有什麼問題?

+0

嘗試在'profile'前刪除斜線:​​Route :: controller('profile','DashboardProfileController'); – cheelahim

+0

@cheelahim我已經做了,但沒有改變任何東西。 – revo

+0

首先放入配置文件控制器。 – cheelahim

回答

1

看起來他們兩個都到一個地方,因此最長的一個應該先去,因爲它被解釋爲參數。

Route::group(array('prefix' => 'dashboard', 'before' => 'auth'), function() 
{ 
    Route::controller('/profile', 'DashboardProfileController'); 
    Route::controller('/', 'DashboardController'); 
});