1 | <?php |
||
2 | |||
3 | namespace app\controllers\admin; |
||
4 | |||
5 | use app\models\{Position, PositionSearch}; |
||
6 | use app\traits\{AdminBeforeActionTrait, AccessTrait}; |
||
7 | use Itstructure\AdminModule\controllers\CommonAdminController; |
||
8 | |||
9 | /** |
||
10 | * Class PositionController |
||
11 | * PositionController implements the CRUD actions for Position model. |
||
12 | * |
||
13 | * @package app\controllers\admin |
||
14 | */ |
||
15 | class PositionController extends CommonAdminController |
||
16 | { |
||
17 | use AdminBeforeActionTrait, AccessTrait; |
||
0 ignored issues
–
show
Bug
introduced
by
![]() |
|||
18 | |||
19 | /** |
||
20 | * @var bool |
||
21 | */ |
||
22 | protected $setEditingScenarios = true; |
||
23 | |||
24 | /** |
||
25 | * @return mixed|string |
||
26 | */ |
||
27 | public function actionIndex() |
||
28 | { |
||
29 | if (!$this->checkAccessToIndex()) { |
||
30 | return $this->accessError(); |
||
31 | } |
||
32 | |||
33 | return parent::actionIndex(); |
||
34 | } |
||
35 | |||
36 | /** |
||
37 | * @param int|string $id |
||
38 | * |
||
39 | * @return mixed |
||
40 | */ |
||
41 | public function actionView($id) |
||
42 | { |
||
43 | if (!$this->checkAccessToView()) { |
||
44 | return $this->accessError(); |
||
45 | } |
||
46 | |||
47 | return parent::actionView($id); |
||
48 | } |
||
49 | |||
50 | /** |
||
51 | * @return mixed|string|\yii\web\Response |
||
52 | */ |
||
53 | public function actionCreate() |
||
54 | { |
||
55 | if (!$this->checkAccessToCreate()) { |
||
56 | return $this->accessError(); |
||
57 | } |
||
58 | |||
59 | return parent::actionCreate(); |
||
60 | } |
||
61 | |||
62 | /** |
||
63 | * @param int|string $id |
||
64 | * |
||
65 | * @return string|\yii\web\Response |
||
66 | */ |
||
67 | public function actionUpdate($id) |
||
68 | { |
||
69 | if (!$this->checkAccessToUpdate()) { |
||
70 | return $this->accessError(); |
||
71 | } |
||
72 | |||
73 | return parent::actionUpdate($id); |
||
74 | } |
||
75 | |||
76 | /** |
||
77 | * @param int|string $id |
||
78 | * |
||
79 | * @return mixed|\yii\web\Response |
||
80 | */ |
||
81 | public function actionDelete($id) |
||
82 | { |
||
83 | if (!$this->checkAccessToDelete()) { |
||
84 | return $this->accessError(); |
||
85 | } |
||
86 | |||
87 | return parent::actionDelete($id); |
||
88 | } |
||
89 | |||
90 | /** |
||
91 | * Returns Contact model name. |
||
92 | * |
||
93 | * @return string |
||
94 | */ |
||
95 | protected function getModelName():string |
||
96 | { |
||
97 | return Position::class; |
||
98 | } |
||
99 | |||
100 | /** |
||
101 | * Returns ContactSearch model name. |
||
102 | * |
||
103 | * @return string |
||
104 | */ |
||
105 | protected function getSearchModelName():string |
||
106 | { |
||
107 | return PositionSearch::class; |
||
108 | } |
||
109 | } |
||
110 |