MicroFrameWork/kernel/modules/post/PostModule.php

36 lines
913 B
PHP
Raw Normal View History

2024-09-12 16:01:04 +03:00
<?php
namespace kernel\modules\post;
use kernel\helpers\Debug;
2024-09-12 16:01:04 +03:00
use kernel\Module;
use kernel\modules\menu\service\MenuService;
use kernel\services\MigrationService;
2024-09-12 16:01:04 +03:00
class PostModule extends Module
{
public MenuService $menuService;
public MigrationService $migrationService;
public function __construct()
{
$this->menuService = new MenuService();
$this->migrationService = new MigrationService();
}
public function init(): void
{
$this->migrationService->runAtPath("{KERNEL_MODULES}/post/migrations");
$this->menuService->createItem([
"label" => "Посты",
"url" => "/admin/post",
"slug" => "post",
]);
}
2024-09-12 16:01:04 +03:00
public function deactivate(): void
2024-09-12 16:01:04 +03:00
{
$this->menuService->removeItemBySlug("post");
$this->migrationService->rollbackAtPath("{KERNEL_MODULES}/post/migrations");
2024-09-12 16:01:04 +03:00
}
}