I has structure of routes:
Route::group(array('before' => 'auth'), function() {
Route::controller('/app/{companyId}', 'AppController');
Route::controller('/app/{companyId}/projects/{projectId}', 'ProjectsController');
Route::controller('/app/{companyId}/task/{taskId}', 'TasksController');
Route::controller('/app/{companyId}/bugs/{bugId}', 'BugsController');
Route::controller('/app/{companyId}/comments/{commentId}', 'CommentsController');
Route::controller('/app/{companyId}/calendar', 'CalendarController');
Route::controller('/', 'CompaniesController');
});
But when i'm trying to open /app/3/project/1 it's not working:
Symfony \ Component \ HttpKernel \ Exception \ NotFoundHttpException
Controller method not found.
What could cause this problem?
Right solution: check right order of your routes(longest mut be in top):
Route::controller('app/{companyId}/project/{projectId}', 'ProjectsController');
Route::controller('app/{companyId}/task/{taskId}', 'TasksController');
Route::controller('/app/{companyId}/bugs/{bugId}', 'BugsController');
Route::controller('/app/{companyId}/comments/{commentId}', 'CommentsController');
Route::controller('/app/{companyId}/calendar', 'CalendarController');
Route::controller('/app/{companyId}', 'AppController');
Route::controller('/', 'CompaniesController');
Try this:
first at all you must specify the route method (get or post), then you must join with @ the action name will be executed in the specified controller
Route::get('/app/{companyId}/bugs/{bugId}', 'BugsController@actionname');
Little bit of experiements, and I found bug. Reason was in position of routes. This works.
Route::controller('app/{companyId}/project/{projectId}', 'ProjectsController');
Route::controller('app/{companyId}/task/{taskId}', 'TasksController');
Route::controller('/app/{companyId}/bugs/{bugId}', 'BugsController');
Route::controller('/app/{companyId}/comments/{commentId}', 'CommentsController');
Route::controller('/app/{companyId}/calendar', 'CalendarController');
Route::controller('/app/{companyId}', 'AppController');
Route::controller('/', 'CompaniesController');
Thanks