46 lines
1.1 KiB
PHP
46 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace app\controllers;
|
|
|
|
use Yii;
|
|
use yii\web\Controller;
|
|
use yii\filters\VerbFilter;
|
|
|
|
/**
|
|
* ScriptController implements the CRUD actions for Script model.
|
|
*/
|
|
class DashboardController extends Controller {
|
|
|
|
public function init() {
|
|
parent::init();
|
|
if (Yii::$app->user->isGuest)
|
|
return $this->redirect(['/site/login']);
|
|
}
|
|
|
|
/**
|
|
* {@inheritdoc}
|
|
*/
|
|
public function behaviors() {
|
|
return [
|
|
'verbs' => [
|
|
'class' => VerbFilter::className(),
|
|
'actions' => [
|
|
'delete' => ['POST'],
|
|
],
|
|
],
|
|
];
|
|
}
|
|
|
|
public function actionIndex() {
|
|
if (!Yii::$app->user->can('administrator'))
|
|
throw new \yii\web\HttpException(403, 'Bạn không có quyền truy cập nội dung này');
|
|
$this->view->title = "Bảng điều khiển";
|
|
$this->view->params['breadcrumbs'][] = 'Bảng điều khiển';
|
|
$tungbui = "vcl";
|
|
return $this->render('index', [
|
|
"tungbui" => $tungbui
|
|
]);
|
|
}
|
|
|
|
}
|