33namespace yii2mod \cms \controllers ;
44
55use Yii ;
6- use yii \filters \VerbFilter ;
76use yii \web \Controller ;
87use yii \web \NotFoundHttpException ;
98use yii \web \UploadedFile ;
@@ -43,12 +42,25 @@ class ManageController extends Controller
4342 public $ modelClass = 'yii2mod\cms\models\CmsModel ' ;
4443
4544 /**
46- * @var string model class name for attachment model
45+ * @var string class name for attachment model
4746 */
4847 public $ attachmentModelClass = 'yii2mod\cms\models\AttachmentModel ' ;
49-
48+
49+ /**
50+ * @var array verb filter config
51+ */
52+ public $ verbFilterConfig = [
53+ 'class ' => 'yii\filters\VerbFilter ' ,
54+ 'actions ' => [
55+ 'index ' => ['get ' ],
56+ 'create ' => ['get ' , 'post ' ],
57+ 'update ' => ['get ' , 'post ' ],
58+ 'delete ' => ['post ' ],
59+ 'file-upload ' => ['post ' ],
60+ ],
61+ ];
62+
5063 /**
51- *
5264 * @var array access control config
5365 */
5466 public $ accessControlConfig = [
@@ -61,23 +73,13 @@ class ManageController extends Controller
6173 ],
6274 ];
6375
64-
6576 /**
6677 * @inheritdoc
6778 */
6879 public function behaviors ()
6980 {
7081 return [
71- 'verbs ' => [
72- 'class ' => VerbFilter::class,
73- 'actions ' => [
74- 'index ' => ['get ' ],
75- 'create ' => ['get ' , 'post ' ],
76- 'update ' => ['get ' , 'post ' ],
77- 'delete ' => ['post ' ],
78- 'file-upload ' => ['post ' ],
79- ],
80- ],
82+ 'verbs ' => $ this ->verbFilterConfig ,
8183 'access ' => $ this ->accessControlConfig ,
8284 ];
8385 }
@@ -96,7 +98,7 @@ public function actions()
9698 }
9799
98100 /**
99- * Lists all CmsModel models.
101+ * List of all cms models.
100102 *
101103 * @return mixed
102104 */
@@ -112,7 +114,7 @@ public function actionIndex()
112114 }
113115
114116 /**
115- * Creates a new CmsModel model .
117+ * Creates a new CmsModel.
116118 *
117119 * If creation is successful, the browser will be redirected to the 'index' page.
118120 *
@@ -134,7 +136,7 @@ public function actionCreate()
134136 }
135137
136138 /**
137- * Updates an existing CmsModel model .
139+ * Updates an existing CmsModel.
138140 *
139141 * If update is successful, the browser will be redirected to the 'index' page.
140142 *
@@ -158,7 +160,7 @@ public function actionUpdate($id)
158160 }
159161
160162 /**
161- * Deletes an existing CmsModel model .
163+ * Deletes an existing CmsModel.
162164 *
163165 * If deletion is successful, the browser will be redirected to the 'index' page.
164166 *
@@ -197,7 +199,7 @@ public function actionFileUpload()
197199 }
198200
199201 /**
200- * Finds the CmsModel model based on its primary key value.
202+ * Finds the CmsModel based on its primary key value.
201203 * If the model is not found, a 404 HTTP exception will be thrown.
202204 *
203205 * @param int $id
0 commit comments