init
This commit is contained in:
45
controllers/DashboardController.php
Normal file
45
controllers/DashboardController.php
Normal file
@@ -0,0 +1,45 @@
|
||||
<?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
|
||||
]);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user