2024-10-15 17:32:33 +03:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace app\modules\module_shop;
|
|
|
|
|
|
|
|
use kernel\Module;
|
|
|
|
use kernel\modules\menu\service\MenuService;
|
|
|
|
use kernel\services\MigrationService;
|
|
|
|
|
|
|
|
class ModuleShopModule extends Module
|
|
|
|
{
|
|
|
|
public MenuService $menuService;
|
|
|
|
public MigrationService $migrationService;
|
|
|
|
public function __construct()
|
|
|
|
{
|
|
|
|
$this->menuService = new MenuService();
|
|
|
|
$this->migrationService = new MigrationService();
|
|
|
|
}
|
|
|
|
|
2024-10-25 15:47:11 +03:00
|
|
|
/**
|
|
|
|
* @throws \Exception
|
|
|
|
*/
|
2024-10-15 17:32:33 +03:00
|
|
|
public function init(): void
|
|
|
|
{
|
|
|
|
$this->migrationService->runAtPath("{APP}/modules/module_shop/migrations");
|
|
|
|
|
|
|
|
$this->menuService->createItem([
|
|
|
|
"label" => "Магазин модулей",
|
|
|
|
"url" => "/admin/module_shop",
|
|
|
|
"slug" => "module_shop",
|
|
|
|
]);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function deactivate(): void
|
|
|
|
{
|
|
|
|
$this->menuService->removeItemBySlug("module_shop");
|
|
|
|
}
|
|
|
|
}
|