Reputation: 83
I'm using Laravel v4.2 and getting the following error:
Class UserController does not exist
Here is my code:
user.php
class UserController extends BaseController {
public function index(){
return View::make('/')->with('title', 'Home | Public Review');
}
}
routes.php
Route::get( '/', array(
'as' => 'index',
'uses' => 'UserController@index'
) );
How do I resolve this error?
Upvotes: 5
Views: 13056
Reputation: 39414
Typically, in Laravel 4, you'll find class UserController
residing in app/controllers/UserController.php
.
Laravel doesn't actually care, so long as the class in your routes.php can be auto-loaded. Consequently, always consider running php artisan dump-autoload
after class name or class file name changes to ensure the autoloader is updated.
Upvotes: 11