some fix
This commit is contained in:
@ -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
|
||||
{
|
||||
|
Reference in New Issue
Block a user