This commit is contained in:
2025-06-18 14:50:18 +03:00
parent a64ed080bb
commit 4c716a8a8c
160 changed files with 6786 additions and 23 deletions

View File

@ -119,4 +119,48 @@ class ModuleController extends ConsoleController
$this->out->r("Модуль $slug создан", 'green');
}
public function actionConstructController(): void
{
$this->out->r("Введите slug контроллера:", 'yellow');
$slug = substr(fgets(STDIN), 0, -1);
$slug = strtolower($slug);
$this->out->r("Введите model контроллера:", 'yellow');
$model = substr(fgets(STDIN), 0, -1);
$this->out->r("Введите путь контроллера:", 'yellow');
$path = substr(fgets(STDIN), 0, -1);
$path = strtolower($path);
$moduleService = new ModuleService();
$moduleService->createController([
'slug' => $slug,
'model' => $model,
], $path);
$this->out->r("Контроллер $slug создан", 'green');
}
public function actionConstructCRUD(): void
{
$this->out->r("Введите slug для CRUD:", 'yellow');
$slug = substr(fgets(STDIN), 0, -1);
$slug = strtolower($slug);
$this->out->r("Введите model для CRUD:", 'yellow');
$model = substr(fgets(STDIN), 0, -1);
$this->out->r("Введите путь для CRUD:", 'yellow');
$path = substr(fgets(STDIN), 0, -1);
$path = strtolower($path);
$moduleService = new ModuleService();
$moduleService->createCRUD([
'slug' => $slug,
'model' => $model,
], $path);
$this->out->r("CRUD $model создан", 'green');
}
}

View File

@ -91,6 +91,14 @@ App::$collector->group(["prefix" => "module"], callback: function (RouteCollecto
[\kernel\console\controllers\ModuleController::class, 'actionConstructModule'],
additionalInfo: ['description' => 'Сгенерировать модуль']
);
App::$collector->console('construct/controller',
[\kernel\console\controllers\ModuleController::class, 'actionConstructController'],
additionalInfo: ['description' => 'Сгенерировать контроллер']
);
App::$collector->console('construct/crud',
[\kernel\console\controllers\ModuleController::class, 'actionConstructCRUD'],
additionalInfo: ['description' => 'Сгенерировать CRUD']
);
});
App::$collector->group(["prefix" => "kernel"], callback: function (RouteCollector $router){