12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576 |
- <?php
- namespace backend\controllers;
- use common\models\AdminLog;
- use yii\data\ActiveDataProvider;
- use yii\filters\VerbFilter;
- use yii\web\Controller;
- use yii\web\NotFoundHttpException;
- class AdminLogController extends Controller
- {
- public function behaviors()
- {
- return [
- 'verbs' => [
- 'class' => VerbFilter::className(),
- 'actions' => [
- 'delete' => ['post'],
- ],
- ],
- ];
- }
-
- public function actionIndex()
- {
- $dataProvider = new ActiveDataProvider([
- 'query' => AdminLog::find(),
- 'sort' => [
- 'defaultOrder' => [
- 'id' => SORT_DESC
- ]
- ]
- ]);
- return $this->render('index', [
- 'dataProvider' => $dataProvider,
- ]);
- }
-
- public function actionView($id)
- {
- return $this->render('view', [
- 'model' => $this->findModel($id),
- ]);
- }
-
- protected function findModel($id)
- {
- if (($model = AdminLog::findOne($id)) !== null) {
- return $model;
- } else {
- throw new NotFoundHttpException('The requested page does not exist.');
- }
- }
- }
|