As I said in the comments, the following command did the trick:
php artisan dump-autoload
Probably something happened during the installation.
Question
I'm new to Laravel, I have a route in my routes.php file like this:
<?php
Route::resource('search', 'SearchController');
?>
and I have the controller app/controllers/SearchController.php that looks like this:
<?php
class SearchController extends \BaseController {
protected $layout = 'layouts.master';
public function create() {}
public function store(){}
public function index(){
return View::make('hello');
}
}
?>
I previously had a controller with unrestful methods name SearchController. I renamed that one to OldSearchController and updated the routes.
and a file hello.php in app/views.
but, whenever I try to access the page via http://localhost/search
, I get the following error:
BadMethodCallException
Method [index] does not exist.
what else needs to be done?
Solution 2
As I said in the comments, the following command did the trick:
php artisan dump-autoload
Probably something happened during the installation.
OTHER TIPS
All you need to do is run this:
composer dump-autoload
Your classes are being cached and there is likely a conflict going on with your previous SearchController.