Support the ongoing development of Laravel.io →
Configuration Requests Architecture
Last updated 2 years ago.
0

I could be wrong, but as the Composer PSR-0 autoloader converts underscores to sub folders, unless your Base_Controller is called Controller and is in a folder called Base, it may not autoload.

http://www.php-fig.org/psr/psr-0/#underscores-in-namespaces-and-class-names

Try using StudlyCaps and see how you go.

You also need to reference the controller name in the route:

Route::get('/', array('as'=>'home', 'uses'=>'QuestionsController@index'));

And any reason you don't just have a straight index() method?

You seem to want to over-complicate things. Keep it simple (forget named routes, your own ideas, etc) and follow the conventions laid out in the docs.

If in doubt, use artisan to create your resful controller:

php artisan make:controller QuestionsController
Last updated 9 years ago.
0

Thanks Dave! As I said, I'm new to Laravel. So if I tend to over-complicate things; that is because I lack experience. Anyway using the Artisan command in the terminal fixed the issue. However I noticed, Laravel extends to Controller and not BaseController in the file they've created for me. I guess things have changed in the new version.

0

No probs, glad to help. I'm also new to Laravel, but luckily not PHP or frameworks :)

You can simply modify the code if you want to extend from a superclass. Laravel's autoloading (I presume, just a PHP autoloader) should find it.

Read up on namespacing, as the namespaces will map to folders!

Good luck :)

0

I will do so. Once again thanks for the suggestions. :)

0

Sign in to participate in this thread!

Eventy

Your banner here too?

devKhairul devkhairul Joined 28 Apr 2015

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.