diff --git a/backend/controllers/SupportController.php b/backend/controllers/SupportController.php new file mode 100644 index 0000000..bddb7cc --- /dev/null +++ b/backend/controllers/SupportController.php @@ -0,0 +1,146 @@ + [ + 'class' => VerbFilter::className(), + 'actions' => [ + 'delete' => [ 'POST' ], + ], + ], + 'access' => [ + 'class' => AccessControl::className(), + 'rules' => [ + [ + 'allow' => true, + 'roles' => [ '@' ], + ], + ], + ], + ]; + } + public function actions() + { + return [ + 'index' => [ + 'class' => Index::className(), + 'columns' => [ + 'name' => [ + 'type' => Index::ACTION_COL, + ], + 'email' => [ + 'type' => Index::STRING_COL + ], + 'status' => [ + 'type' => Index::STATUS_COL, + ], + 'created_at' => [ + 'type' => Index::DATETIME_COL, + ] + ], + 'model' => Support::className(), + 'hasLanguage' => false, + 'enableMassDelete' => true, + 'modelPrimaryKey' => 'id', + 'defaultSort' => [ + 'created_at' => 'DESC', + ], + 'create' => false + ], + 'view' => [ + 'class' => View::className(), + 'model' => Support::className(), + 'hasAlias' => false, + 'hasGallery' => false, + 'languageFields' => [ + ], + 'fields' => [ + [ + 'name' => 'name', + 'type' => Form::STRING, + ], + [ + 'name' => 'email', + 'type' => Form::STRING, + ], + [ + 'name' => 'sum', + 'type' => Form::STRING, + ], + [ + 'name' => 'created_at', + 'type' => Form::STRING, + ], + + ], + ], + 'delete' => [ + 'class' => Delete::className(), + ], + ]; + } + + public function findModel($id) + { + + $model = Support::find() + ->where([ 'id' => $id ]) + ->one(); + if ($model !== null) { + return $model; + } else { + throw new NotFoundHttpException('The requested page does not exist.'); + } + } + + public function deleteModel($id) + { + $category = Support::find() + ->where( + [ + 'id' => $id, + ] + ) + ->one(); + + + return $category->delete(); + } + + public function actionUpdate($id) + { + $model = $this->findModel($id); + if ($model->load(\Yii::$app->request->post()) && $model->save()) { + return $this->redirect('index'); + } else { + return $this->render( + 'update', + [ + 'model' => $model, + ] + ); + } + } + } \ No newline at end of file diff --git a/backend/views/layouts/menu_items.php b/backend/views/layouts/menu_items.php index b81c637..5279742 100755 --- a/backend/views/layouts/menu_items.php +++ b/backend/views/layouts/menu_items.php @@ -60,6 +60,11 @@ 'url' => [ '/comment/index' ], ], + [ + 'label' => \Yii::t('app', 'Support'), + 'url' => [ '/support/index' ], + + ], ], ], diff --git a/backend/views/support/_form.php b/backend/views/support/_form.php new file mode 100644 index 0000000..b56d948 --- /dev/null +++ b/backend/views/support/_form.php @@ -0,0 +1,59 @@ +registerJs($js, View::POS_READY); + +?> + +