| Current Path : /var/www/html/helpdesk/controllers/ |
| Current File : /var/www/html/helpdesk/controllers/DashboardController.php |
<?php
namespace app\controllers;
use Yii;
use yii\filters\AccessControl;
use yii\web\Controller;
use yii\filters\VerbFilter;
use app\models\ProjectsSearch;
use app\models\Projects;
class DashboardController extends Controller {
public function behaviors() {
return [
'access' => [
'class' => AccessControl::className(),
'only' => ['logout'],
'rules' => [
[
'actions' => ['logout'],
'allow' => true,
'roles' => ['@'],
],
],
],
'verbs' => [
'class' => VerbFilter::className(),
'actions' => [
'logout' => ['post'],
],
],
];
}
public function actionIndex() {
if (Yii::$app->user->identity->role == 'USER')
return $this->redirect('index.php?r=ticket/index');
else if (Yii::$app->user->identity->role == 'STAFF')
return $this->redirect('index.php?r=ticket/indexstaff');
else
return $this->render('index');
}
public function actionDetails($id) {
$modelProject = Projects::findOne($id);
if (!empty($modelProject))
return $this->render('details', ['modelProject' => $modelProject,]);
}
}