admin init command

This commit is contained in:
2024-09-23 17:03:42 +03:00
parent 0f05bc2391
commit a48088581f
25 changed files with 376 additions and 34 deletions

View File

@ -76,21 +76,20 @@ class OptionController extends AdminController
*/
public function actionEdit(int $id): void
{
Debug::prn($_REQUEST);
$option = Option::find($id);
if (!$option) {
throw new \Exception('Option not found');
}
$optionForm = new CreateOptionForm();
$optionService = new OptionService();
$optionForm->load($_REQUEST);
if ($optionForm->validate()) {
$option = $optionService->update($optionForm, $option);
$option = $this->optionService->update($optionForm, $option);
if ($option) {
$this->redirect('/admin/option' . $option->id);
$this->redirect('/admin/option/' . $option->id);
}
}
$this->redirect('/admin/option/update' . $id);
$this->redirect('/admin/option/update/' . $id);
}
#[NoReturn] public function actionDelete(int $id): void