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?
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.
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