I was updating my Laravel 3 app to Laravel 4 when I hit this problem...
Routes I have tried:
Route::get('backend/login', 'backend/UserController@login');
Route::get('backend/login', 'backend.UserController@login');
I was updating my Laravel 3 app to Laravel 4 when I hit this problem...
Routes I have tried:
Route::get('backend/login', 'backend/UserController@login');
Route::get('backend/login', 'backend.UserController@login');
At the moment, in Laravel 4 Beta 1, you can "only ?" use namespace.
For exemple here in your controller file: app/controllers/backend/UserController.php
So after, in file: app/routes.php :
I don't know if is the better way, but working here. Edit & dump-autoload "composer.json" seems not work actualy.
If someone can improve that, he will make my day ! :)
I recommend doing
see more info here
Laravel 4 nested resource controllers Route::resource('admin/photo', 'PhotoController'); not working
My Admin Controller in app/controllers directory
Now I have a folder named admin in controllers folder i.e app/controllers/admin and I have another controller there named AdminDashboardController.php
And Lastly My Route.php file
Hope this helps ..:-)
I had a similar issue just a few hours ago and had to play a little bit with it to have it working.
Routes:
In "controllers/admin" i put the DashboardController:
That did the trick on Laravel 4. Hope you find it useful enough. :)
As explained here, with Laravel 4.1 you can specify the namespace to be used on a group of routes, as you can see here: http://www.laravel-tricks.com/tricks/route-group-namespacing
I've been using it, and are quite good, it helps you keep your code cleaner and more understandable. Give it a try!
If you are gonna use Laravel 4, perhaps you should take a look of this: You can specify the namespace to be used on a group of routes, as you can see here: http://www.laravel-tricks.com/tricks/route-group-namespacing
So in your sample:
It works like a charm :)
I've been using it, and are quite good, it helps you keep your code cleaner and more understandable. Give it a try!