1313
1414/**
1515 * Class ItemController
16+ *
1617 * @package yii2mod\rbac\base
1718 */
1819class ItemController extends Controller
1920{
2021 /**
21- * @var integer Type of Auth Item
22+ * @var int Type of Auth Item
2223 */
2324 protected $ type ;
2425
@@ -42,16 +43,16 @@ public function behaviors()
4243 'update ' => ['get ' , 'post ' ],
4344 'delete ' => ['post ' ],
4445 'assign ' => ['post ' ],
45- 'remove ' => ['post ' ]
46- ]
46+ 'remove ' => ['post ' ],
47+ ],
4748 ],
4849 'contentNegotiator ' => [
4950 'class ' => 'yii\filters\ContentNegotiator ' ,
5051 'only ' => ['assign ' , 'remove ' ],
5152 'formats ' => [
52- 'application/json ' => Response::FORMAT_JSON
53- ]
54- ]
53+ 'application/json ' => Response::FORMAT_JSON ,
54+ ],
55+ ],
5556 ];
5657 }
5758
@@ -75,6 +76,7 @@ public function actionIndex()
7576 * Displays a single AuthItem model.
7677 *
7778 * @param string $id
79+ *
7880 * @return mixed
7981 */
8082 public function actionView ($ id )
@@ -93,11 +95,12 @@ public function actionView($id)
9395 */
9496 public function actionCreate ()
9597 {
96- $ model = new AuthItemModel ;
98+ $ model = new AuthItemModel () ;
9799 $ model ->type = $ this ->type ;
98100
99101 if ($ model ->load (Yii::$ app ->request ->post ()) && $ model ->save ()) {
100102 Yii::$ app ->session ->setFlash ('success ' , Yii::t ('yii2mod.rbac ' , 'Item has been saved. ' ));
103+
101104 return $ this ->redirect (['view ' , 'id ' => $ model ->name ]);
102105 }
103106
@@ -110,6 +113,7 @@ public function actionCreate()
110113 * If update is successful, the browser will be redirected to the 'view' page.
111114 *
112115 * @param string $id
116+ *
113117 * @return mixed
114118 */
115119 public function actionUpdate ($ id )
@@ -118,6 +122,7 @@ public function actionUpdate($id)
118122
119123 if ($ model ->load (Yii::$ app ->request ->post ()) && $ model ->save ()) {
120124 Yii::$ app ->session ->setFlash ('success ' , Yii::t ('yii2mod.rbac ' , 'Item has been saved. ' ));
125+
121126 return $ this ->redirect (['view ' , 'id ' => $ model ->name ]);
122127 }
123128
@@ -130,6 +135,7 @@ public function actionUpdate($id)
130135 * If deletion is successful, the browser will be redirected to the 'index' page.
131136 *
132137 * @param string $id
138+ *
133139 * @return mixed
134140 */
135141 public function actionDelete ($ id )
@@ -145,6 +151,7 @@ public function actionDelete($id)
145151 * Assign items
146152 *
147153 * @param string $id
154+ *
148155 * @return array
149156 */
150157 public function actionAssign ($ id )
@@ -160,6 +167,7 @@ public function actionAssign($id)
160167 * Remove items
161168 *
162169 * @param string $id
170+ *
163171 * @return array
164172 */
165173 public function actionRemove ($ id )
@@ -201,6 +209,7 @@ public function getLabels()
201209 * If the model is not found, a 404 HTTP exception will be thrown.
202210 *
203211 * @param string $id
212+ *
204213 * @return AuthItemModel the loaded model
205214 *
206215 * @throws NotFoundHttpException if the model cannot be found
@@ -216,4 +225,4 @@ protected function findModel($id)
216225 throw new NotFoundHttpException (Yii::t ('yii2mod.rbac ' , 'The requested page does not exist. ' ));
217226 }
218227 }
219- }
228+ }
0 commit comments