diff --git a/backend/controllers/RequestController.php b/backend/controllers/RequestController.php new file mode 100644 index 0000000..639bf34 --- /dev/null +++ b/backend/controllers/RequestController.php @@ -0,0 +1,95 @@ + [ + 'class' => Index::class, + 'columns' => [ + 'name' => [ + 'type' => Index::ACTION_COL, + 'columnConfig' => [ + 'buttonsTemplate' => '{edit}{delete}' + ] + ], + 'secondname' => [ + 'type' => Index::STRING_COL, + ], + 'organization' => [ + 'type' => Index::STRING_COL, + ], + ], + 'model' => Customer::class, + 'hasLanguage' => false, + 'enableMassDelete' => true, + 'modelPrimaryKey' => 'id', + 'create' => false, + ], + ]; + } + + public function actionUpdate($id) + { + $model = $this->findModel($id); + + return $this->render( + 'update', + [ + 'model' => $model, + ] + ); + } + + /** + * @param $id + * + * @return \common\models\Customer|mixed|null + * @throws \yii\web\NotFoundHttpException + */ + public function findModel($id) + { + $model = Customer::findOne($id); + if ($model) { + return $model; + } else { + throw new NotFoundHttpException(); + } + } + /** + * Create new model + * + * @return mixed + */ + public function newModel() + { + return new Customer(); + } + /** + * @param $id + * + * @return bool|mixed + * @throws \Throwable + * @throws \yii\db\StaleObjectException + * @throws \yii\web\NotFoundHttpException + */ + public function deleteModel($id) + { + $model = $this->findModel($id); + + if ($model->delete()) { + return true; + } else { + return false; + } + } + } \ No newline at end of file diff --git a/backend/views/layouts/main.php b/backend/views/layouts/main.php index edabbd4..e05c3ee 100755 --- a/backend/views/layouts/main.php +++ b/backend/views/layouts/main.php @@ -7,16 +7,11 @@ use artbox\core\assets\ArtboxCoreAsset; use artbox\core\models\User; - use artbox\core\models\UserData; - use artbox\core\widgets\FeedbackWidget; use artbox\core\widgets\FlashWidget; - use artbox\order\assets\OrderAsset; - use noam148\imagemanager\components\ImageManagerGetPath; use yii\bootstrap\Html; use yii\web\View; use yii\widgets\Breadcrumbs; use yiister\gentelella\widgets\Menu; - use backend\assets\AppAsset; ArtboxCoreAsset::register($this); // AppAsset::register($this); @@ -167,7 +162,9 @@