增加管理员相关控制器及基础页面视图
*内容后续建设
This commit is contained in:
parent
dcc7e23bab
commit
cb75247978
80
controllers/AdminController.php
Normal file
80
controllers/AdminController.php
Normal file
@ -0,0 +1,80 @@
|
||||
<?php
|
||||
|
||||
namespace app\controllers;
|
||||
|
||||
use Yii;
|
||||
use yii\filters\AccessControl;
|
||||
use yii\filters\VerbFilter;
|
||||
use yii\web\Controller;
|
||||
|
||||
class AdminController extends Controller
|
||||
{
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function behaviors(): array
|
||||
{
|
||||
return array_merge(
|
||||
parent::behaviors(),
|
||||
[
|
||||
'access' => [
|
||||
'class' => AccessControl::class,
|
||||
'rules' => [
|
||||
[
|
||||
'allow' => true,
|
||||
'actions' => ['index', 'system', 'user', 'info'],
|
||||
'roles' => ['admin'], // only admin can do these
|
||||
]
|
||||
],
|
||||
],
|
||||
'verbs' => [
|
||||
'class' => VerbFilter::class,
|
||||
'actions' => [
|
||||
'index' => ['GET'],
|
||||
'system' => ['GET'],
|
||||
'user' => ['GET'],
|
||||
'info' => ['GET'],
|
||||
],
|
||||
],
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
public function init(): void
|
||||
{
|
||||
parent::init();
|
||||
$this->layout = 'admin_main';
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function actionIndex(): string
|
||||
{
|
||||
return $this->render('index');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function actionSystem(): string
|
||||
{
|
||||
return $this->render('system');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function actionUser(): string
|
||||
{
|
||||
return $this->render('user');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function actionInfo(): string
|
||||
{
|
||||
return $this->render('info');
|
||||
}
|
||||
}
|
8
views/admin/index.php
Normal file
8
views/admin/index.php
Normal file
@ -0,0 +1,8 @@
|
||||
<?php
|
||||
/** @var yii\web\View $this */
|
||||
?>
|
||||
<h1>admin/index</h1>
|
||||
|
||||
<p>
|
||||
这里是管理员页面.建设中
|
||||
</p>
|
8
views/admin/info.php
Normal file
8
views/admin/info.php
Normal file
@ -0,0 +1,8 @@
|
||||
<?php
|
||||
/** @var yii\web\View $this */
|
||||
?>
|
||||
<h1>admin/index</h1>
|
||||
|
||||
<p>
|
||||
这里是管理员页面.建设中
|
||||
</p>
|
8
views/admin/system.php
Normal file
8
views/admin/system.php
Normal file
@ -0,0 +1,8 @@
|
||||
<?php
|
||||
/** @var yii\web\View $this */
|
||||
?>
|
||||
<h1>admin/index</h1>
|
||||
|
||||
<p>
|
||||
这里是管理员页面.建设中
|
||||
</p>
|
8
views/admin/user.php
Normal file
8
views/admin/user.php
Normal file
@ -0,0 +1,8 @@
|
||||
<?php
|
||||
/** @var yii\web\View $this */
|
||||
?>
|
||||
<h1>admin/index</h1>
|
||||
|
||||
<p>
|
||||
这里是管理员页面.建设中
|
||||
</p>
|
Loading…
x
Reference in New Issue
Block a user