MicroFrameWork/kernel/modules/user/UserModule.php

48 lines
1.1 KiB
PHP

<?php
namespace kernel\modules\user;
use kernel\Module;
use kernel\modules\menu\service\MenuService;
class UserModule extends Module
{
public MenuService $menuService;
public function __construct()
{
$this->menuService = new MenuService();
}
/**
* @throws \Exception
*/
public function init(): void
{
$this->menuService->createItem([
"label" => "Пользователи",
"url" => "/admin/user",
"slug" => "user",
]);
$this->menuService->createItem([
"label" => "Список",
"url" => "/admin/user",
"slug" => "user_list",
"parent_slug" => "user",
]);
$this->menuService->createItem([
"label" => "Создать",
"url" => "/admin/user/create",
"slug" => "user_create",
"parent_slug" => "user",
]);
}
public function deactivate(): void
{
$this->menuService->removeItemBySlug("user_create");
$this->menuService->removeItemBySlug("user_list");
$this->menuService->removeItemBySlug("user");
}
}