This commit is contained in:
2024-10-17 11:35:56 +03:00
parent 9af44ca95f
commit 5285acae12
28 changed files with 34 additions and 355 deletions

View File

@ -84,42 +84,14 @@ class ModuleShopController extends AdminController
public function actionView(int $id): void
{
$module = ModuleShop::find($id);
$module = ModuleShop::find($id);
if (!$module) {
throw new Exception("The module not found");
}
$this->cgView->render("view.php", ['module' => $module]);
}
public function actionUpdate(int $id): void
{
$model = ModuleShop::find($id);
if (!$model) {
throw new Exception("The module not found");
}
$this->cgView->render("form.php", ['model' => $model]);
}
public function actionEdit(int $id): void
{
$module = ModuleShop::find($id);
if (!$module) {
throw new Exception("The module not found");
}
$moduleForm = new CreateModuleShopForm();
$moduleForm->load($_REQUEST);
if ($moduleForm->validate()) {
$module = $this->moduleShopService->update($moduleForm, $module);
if ($module) {
$this->redirect("/admin/module_shop/" . $module->id);
}
}
$this->redirect("/admin/module_shop/update/" . $id);
}
public function actionDelete(int $id): void
{