Issues (27)

backend/controllers/LogsController.php (1 issue)

1
<?php
2
3
namespace backend\controllers;
4
5
use Yii;
6
use backend\models\Log;
7
use backend\models\search\LogSearch;
8
use backend\components\Controller;
9
use yii\web\NotFoundHttpException;
10
use yii\filters\VerbFilter;
11
12
/**
13
 * LogsController implements the CRUD actions for Log model.
14
 */
15
class LogsController extends Controller
16
{
17
    /**
18
     * @var string
19
     */
20
    protected $modelClass = Log::class;
21
22
    /**
23
     * @inheritdoc
24
     */
25
    public function behaviors()
26
    {
27
        return [
28
            'verbs' => [
29
                'class' => VerbFilter::className(),
0 ignored issues
show
Deprecated Code introduced by
The function yii\base\BaseObject::className() has been deprecated: since 2.0.14. On PHP >=5.5, use `::class` instead. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

29
                'class' => /** @scrutinizer ignore-deprecated */ VerbFilter::className(),

This function has been deprecated. The supplier of the function has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the function will be removed and what other function to use instead.

Loading history...
30
                'actions' => [
31
                    'delete' => ['POST'],
32
                ],
33
            ],
34
        ];
35
    }
36
37
    /**
38
     * Lists all Log models.
39
     * @return mixed
40
     */
41
    public function actionIndex()
42
    {
43
        $searchModel = new LogSearch();
44
        $dataProvider = $searchModel->search(Yii::$app->request->queryParams);
45
46
        return $this->render('index', [
47
            'searchModel' => $searchModel,
48
            'dataProvider' => $dataProvider,
49
        ]);
50
    }
51
52
    /**
53
     * Displays a single Log model.
54
     * @param integer $id
55
     * @return mixed
56
     * @throws NotFoundHttpException if the model cannot be found
57
     */
58
    public function actionView($id)
59
    {
60
        return $this->render('view', [
61
            'model' => $this->findModel($id),
62
        ]);
63
    }
64
65
    /**
66
     * @inheritdoc
67
     */
68
    public function render($view, $params = [])
69
    {
70
        return parent::render($view, $params + [
71
            'itemTypes' => Log::listItemTypes(),
72
        ]);
73
    }
74
}
75