server test version
This commit is contained in:
39
kernel/app_modules/tgbot/TgbotModule.php
Normal file
39
kernel/app_modules/tgbot/TgbotModule.php
Normal file
@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
namespace kernel\app_modules\tgbot;
|
||||
|
||||
use kernel\Module;
|
||||
use kernel\modules\menu\service\MenuService;
|
||||
use kernel\services\MigrationService;
|
||||
|
||||
class TgbotModule 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}/tgbot/migrations");
|
||||
|
||||
$this->menuService->createItem([
|
||||
"label" => "TG bot",
|
||||
"url" => "/admin/tg-bot",
|
||||
"slug" => "tg-bot",
|
||||
]);
|
||||
}
|
||||
|
||||
public function deactivate()
|
||||
{
|
||||
$this->menuService->removeItemBySlug("tg-bot");
|
||||
$this->migrationService->rollbackAtPath("{KERNEL_APP_MODULES}/tgbot/migrations");
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user