37 lines
898 B
PHP
37 lines
898 B
PHP
<?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();
|
|
}
|
|
|
|
/**
|
|
* @throws \Exception
|
|
*/
|
|
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");
|
|
}
|
|
} |