backend/app/modules/slider/SliderModule.php

38 lines
855 B
PHP

<?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("{APP}/modules/slider/migrations");
$this->menuService->createItem([
"label" => "Слайдер",
"url" => "/admin/slider",
"slug" => "slider",
]);
}
public function deactivate(): void
{
$this->menuService->removeItemBySlug("slider");
}
}