revo
revo

Reputation: 48751

Prefixing route controllers

I've two route controllers within a route group:

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

That works until I add prefix key to the array:

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

It's weird as the first route controller works since I can access localhost/dashboard but the second fails on localhost/dashboard/profile and or localhost/dashboard/profile/edit

What's wrong here?!

Upvotes: 0

Views: 59

Answers (1)

user2920996
user2920996

Reputation:

It seems both of them route to one location, therefore the longest one should go first because it is interpreted as argument.

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

Upvotes: 1

Related Questions