PandaUser
PandaUser

Reputation: 83

Laravel 4: Class does not exist

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

Answers (2)

rdgutierrez
rdgutierrez

Reputation: 1

Is because the correct is composer dump-autoload

Upvotes: -1

bishop
bishop

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

Related Questions