Why do I get a
Class 'Search_Controller' not found
when doing this:
class Snippets_Controller extends Search_Controller {
public $restful = true;
public function get_index()
{
$snippets = Snippet::all();
$categories = Categorie::all();
return View::make('snippet.index')->with(array(
'snippets' => $snippets,
'categories' => $categories,
'active_categorie' => Session::get('active_categorie_id')
)
);
}
The Search Controller:
class Search_Controller extends Base_Controller {
protected static function build_html_for_search_results($search_results)
{
...
You should autoload this in you application start.php folder. If you open that file, and you search for "Base_Controller", you will see something like this:
Autoloader::map(array(
'Base_Controller' => path('app').'controllers/base.php'
));
The only thing you have to do is add the search controller there:
Autoloader::map(array(
'Base_Controller' => path('app').'controllers/base.php',
'Search_Controller' => path('app').'controllers/search.php'
));
And that should do the trick.
Laravel loads controllers based on the name that's requested, and it doesn't autload any of the controllers, as it would be a waste of time for 90% of the controllers.