MicroFrameWork/kernel/modules/user/UserModule.php

48 lines
1.1 KiB
PHP
Raw Normal View History

2024-09-12 16:01:04 +03:00
<?php
namespace kernel\modules\user;
use kernel\Module;
use kernel\modules\menu\service\MenuService;
2024-09-12 16:01:04 +03:00
class UserModule extends Module
{
public MenuService $menuService;
public function __construct()
2024-09-12 16:01:04 +03:00
{
$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");
2024-09-12 16:01:04 +03:00
}
}