I know there are tickets here, which are talking about the similar scenario, but I can't find any answer that would satisfy my case.
I'm trying to do the following:
Route::group(
[
'prefix' => 'admin',
'namespace' => 'Admin'
],
function() {
Route::controller('/', 'LoginController');
Route::group(
[
'prefix' => '',
'before' => 'auth.admin'
],
function() {
Route::controller('page', 'PageController');
Route::controller('article', 'ArticleController');
}
);
}
);
When I call /admin I get the LoginController and it's getIndex() view, but when I call /admin/page - I get:
Symfony \ Component \ HttpKernel \ Exception \ NotFoundHttpException
Controller method not found.
I know you can nest Route::group calls, but it doesn't seem to be documented well anywhere how to achieve it. From my understanding, you have to have 'prefix' specified with each Route::group call - In the nested one I've just used blank string '' - as it doesn't require any additional prefix apart from the parent one. The encapsulated calls to controllers within the nested group require admin.auth filter - and that's the reason why I wanted to enclose them in the nested group - rather than specifying filter for each controller separately.
Any idea what needs to be done to make this scenario work?
Also - even if I change the code so that it calls controllers directly under the parent group like so:
Route::group(
[
'prefix' => 'admin',
'namespace' => 'Admin'
],
function() {
Route::controller('/', 'LoginController');
Route::controller('page', 'PageController');
Route::controller('article', 'ArticleController');
}
);
I seem to be getting the same error when I call /admin/page - PageController looks like this:
namespace Admin;
use BaseController; use View;
class PageController extends BaseController {
public function getIndex() {
return View::make('Admin.page.index');
}
}