<?php namespace app\modules\slider; use kernel\Module; use kernel\modules\menu\service\MenuService; use kernel\services\MigrationService; class SliderModule 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("{KERNEL_APP_MODULES}/slider/migrations"); $this->menuService->createItem([ "label" => "Слайдер", "url" => "/admin/slider", "slug" => "slider", ]); } public function deactivate(): void { $this->menuService->removeItemBySlug("slider"); } }