Laravel 4 Can't find BaseController from namespaced controller

痴心易碎 提交于 2019-12-05 19:03:46
class HomeController extends \BaseController {

Basically because you are in a namespace you need to resolve the BaseController in the global namespace (That's what the \ does).

You could also get away with having

use \BaseController;

class HomeController extends BaseController {

But since you are only going to be referring to BaseController once in the entire controller there's not much point.

The other potential problem is your namespacing which is what PageTypes\Home\controllers\HomeController is referring to. That's not actually the Pathname, thats the namespace name it's looking for (it just so happens that the autoloaders that follow PSR match the directory structure to the namespaces).

Try using

namespace PageTypes\Home;

instead of just PageTypes

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!