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 had a similar issue just a few hours ago and had to play a little bit with it to have it working.
Routes:
Route::group(array('prefix' => 'admin'), function() {
Route::resource('/', 'admin\DashboardController');
});
In "controllers/admin" i put the DashboardController:
namespace admin;
use Illuminate\Support\Facades\View;
class DashboardController extends \BaseController {
public function index()
{
return View::make('admin/dashboard');
}
}
That did the trick on Laravel 4. Hope you find it useful enough. :)
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
<?php namespace Controllers\Backend;
use Illuminate\Routing\Controllers\Controller;
class UserController extends Controller {
// Note extends Controller and not BaseController
// Your stuff
}
?>
So after, in file: app/routes.php :
<?php
Route::get('backend/login', 'Controllers\Backend\UserController@login');
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 ! :)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With