templates controllers and module create in terminal

This commit is contained in:
2024-12-10 15:28:34 +03:00
parent fb39da53a6
commit 3c0b78ea56
5 changed files with 193 additions and 0 deletions

View File

@ -90,4 +90,28 @@ class ModuleController extends ConsoleController
}
}
public function actionConstructModule(): void
{
$this->out->r("Введите название модуля:", 'yellow');
$name = substr(fgets(STDIN), 0, -1);
$this->out->r("Введите автора модуля:", 'yellow');
$author = substr(fgets(STDIN), 0, -1);
$slug = strtolower($name);
$moduleService = new ModuleService();
$moduleService->createDirs($slug);
$moduleService->createManifest([
'name' => $name,
'author' => $author,
'slug' => $slug
]);
$moduleService->createControllers($slug);
}
}

View File

@ -30,6 +30,7 @@ App::$collector->group(["prefix" => "module"], callback: function (RouteCollecto
App::$collector->console('uninstall', [\kernel\console\controllers\ModuleController::class, 'actionUninstallModule']);
App::$collector->console('pack', [\kernel\console\controllers\ModuleController::class, 'actionPackModule']);
App::$collector->console('update', [\kernel\console\controllers\ModuleController::class, 'actionUpdateModule']);
App::$collector->console('construct', [\kernel\console\controllers\ModuleController::class, 'actionConstructModule']);
});
App::$collector->group(["prefix" => "kernel"], callback: function (RouteCollector $router){