Hello, I have installed the advanced tamplate and I have the follow question:
-
I created my own base controller in common folder.
-
I want to use my basecontroller in backend folder, so I used:
class SiteController extends \common\controllers\BaseController
But I got the Php fatal error:
Class ‘common\controllers\BaseController’ not found
Can you help me please? (Sorry my english is very poor)
common/Basecontroller.php
<?php
namespace common\controllers;
use Yii;
use yii\web\Controller;
use common\models\AccessHelpers;
class BaseController extends Controller {
public function beforeAction($action)
{
if (!parent::beforeAction($action)) {
return false;
}
$operacion = str_replace("/", "-", Yii::$app->controller->route);
if (AccessHelpers::getAcceso($operacion)) {
return true;
}else{
echo $this->render('@common/views/autenticacion/nopermitido');
return false;
}
return true;
}
}
backend/SiteController.php
<?php
namespace backend\controllers;
use Yii;
//use common\controllers\Basecontroller;
use yii\filters\AccessControl;
use yii\filters\VerbFilter;
use common\models\LoginForm;
use yii\web\Controller;
/**
* Site controller
*/
class SiteController extends \common\controllers\BaseController
{
/**