menuService = new MenuService(); $this->consoleService = new ConsoleService(); $this->migrationService = new MigrationService(); } /** * @throws \Exception */ public function init(): void { $this->migrationService->runAtPath("{KERNEL_APP_MODULES}/card/migrations"); $this->consoleService->runComposerRequire("dragon-code/card-number"); $this->consoleService->runComposerRequire("endroid/qr-code"); $this->menuService->createItem([ "label" => "Card", "url" => "/admin/card", "slug" => "card", ]); $this->menuService->createItem([ "label" => "Список карт", "url" => "/admin/card", "slug" => "card_list", "parent_slug" => "card" ]); $this->menuService->createItem([ "label" => "Шаблоны карт", "url" => "/admin/card_template", "slug" => "card_template", "parent_slug" => "card" ]); $this->menuService->createItem([ "label" => "Программы", "url" => "/admin/card_program", "slug" => "card_program", "parent_slug" => "card" ]); $this->menuService->createItem([ "label" => "Условия", "url" => "/admin/card_program_conditions", "slug" => "card_program_conditions", "parent_slug" => "card" ]); $this->menuService->createItem([ "label" => "Транзакции", "url" => "/admin/card_transaction", "slug" => "card_transaction", "parent_slug" => "card" ]); } /** * @throws \Exception */ public function deactivate(): void { $this->menuService->removeItemBySlug("card"); $this->menuService->removeItemBySlug("card_list"); $this->menuService->removeItemBySlug("card_template"); $this->menuService->removeItemBySlug("card_program"); $this->menuService->removeItemBySlug("card_program_conditions"); $this->menuService->removeItemBySlug("card_transaction"); $this->migrationService->rollbackAtPath("{KERNEL_APP_MODULES}/card/migrations"); $this->consoleService->runComposerRemove("dragon-code/card-number"); $this->consoleService->runComposerRemove("endroid/qr-code"); } }