This commit is contained in:
Kavalar 2024-12-12 15:04:45 +03:00
parent 57c715807a
commit b00c005b09
7 changed files with 23 additions and 6 deletions

View File

@ -2,7 +2,9 @@
namespace kernel\console\controllers;
use kernel\App;
use kernel\console\ConsoleController;
use kernel\helpers\Debug;
class MainController extends ConsoleController
{
@ -12,4 +14,12 @@ class MainController extends ConsoleController
$this->out->r("Привет", "green");
}
public function actionHelp(): void
{
// Debug::dd(App::$collector->getData());
// foreach (App::$collector->getDescriptions() as $description){
// $this->out->r($description, "green");
// }
}
}

View File

@ -113,6 +113,7 @@ class ModuleController extends ConsoleController
'model' => ucfirst($slug),
'author' => $author,
'name' => $name,
'label' => $label,
]);
$this->out->r("Модуль $slug создан", 'green');

View File

@ -4,6 +4,7 @@ use kernel\App;
use Phroute\Phroute\RouteCollector;
App::$collector->console("hello", [\kernel\console\controllers\MainController::class, "indexAction"]);
App::$collector->console("help", [\kernel\console\controllers\MainController::class, "actionHelp"]);
App::$collector->group(["prefix" => "migration"], callback: function (RouteCollector $router){
App::$collector->console('run', [\kernel\console\controllers\MigrationController::class, 'actionRun']);

View File

@ -569,10 +569,9 @@ class ModuleService
{
$data = file_get_contents($templatePath);
$data = str_replace('{slug}', $params['slug'], $data);
$data = str_replace('{model}', $params['model'], $data);
$data = str_replace('{name}', $params['name'], $data);
$data = str_replace('{author}', $params['author'], $data);
foreach ($params as $key => $param){
$data = str_replace("{" . $key . "}", $param, $data);
}
file_put_contents($filePath, $data);
}

View File

@ -7,7 +7,7 @@ use JetBrains\PhpStorm\NoReturn;
use kernel\AdminController;
use kernel\app_modules\{slug}\models\forms\Create{model}Form;
use kernel\app_modules\{slug}\models\{model};
use kernel\app_modules\{slug}\service\{model}Service;
use kernel\app_modules\{slug}\services\{model}Service;
class {model}Controller extends AdminController
{

View File

@ -1,6 +1,6 @@
<?php
namespace kernel\app_modules\{slug}\service;
namespace kernel\app_modules\{slug}\services;
use kernel\helpers\Debug;
use kernel\app_modules\{slug}\models\{model};

View File

@ -3,6 +3,7 @@
/**
* @var \Illuminate\Database\Eloquent\Collection ${slug}
* @var int $page_number
* @var \kernel\CgView $view
*/
use kernel\app_modules\{slug}\models\{model};
@ -13,6 +14,11 @@ use kernel\widgets\IconBtn\IconBtnDeleteWidget;
use kernel\widgets\IconBtn\IconBtnEditWidget;
use kernel\widgets\IconBtn\IconBtnViewWidget;
$view->setTitle("Список {slug}");
$view->setMeta([
'description' => 'Список {slug} системы'
]);
//Для использования таблицы с моделью, необходимо создать таблицу в базе данных
//$table = new ListEloquentTable(new EloquentDataProvider({model}::class, [
// 'currentPage' => $page_number,