From 3ef7f2946bb18347c69d2aa90072cd6e0d90b025 Mon Sep 17 00:00:00 2001 From: stasbilay02 Date: Wed, 4 Dec 2024 11:20:20 +0300 Subject: [PATCH] env example update, some fix --- .env.example | 14 +++--- app/modules/slider/SliderModule.php | 38 ---------------- .../slider/controllers/SliderController.php | 35 --------------- app/modules/slider/manifest.json | 13 ------ .../2024_12_03_124749_create_slider_table.php | 31 ------------- app/modules/slider/models/Slider.php | 39 ----------------- app/modules/slider/routs/slider.php | 20 --------- app/modules/slider/views/index.php | 43 ------------------- app/modules/slider/views/view.php | 29 ------------- .../controllers/AdminConsoleController.php | 2 +- kernel/services/ModuleService.php | 2 +- 11 files changed, 9 insertions(+), 257 deletions(-) delete mode 100644 app/modules/slider/SliderModule.php delete mode 100644 app/modules/slider/controllers/SliderController.php delete mode 100644 app/modules/slider/manifest.json delete mode 100644 app/modules/slider/migrations/2024_12_03_124749_create_slider_table.php delete mode 100644 app/modules/slider/models/Slider.php delete mode 100644 app/modules/slider/routs/slider.php delete mode 100644 app/modules/slider/views/index.php delete mode 100644 app/modules/slider/views/view.php diff --git a/.env.example b/.env.example index ac75a63..64e043c 100644 --- a/.env.example +++ b/.env.example @@ -1,16 +1,16 @@ DB_HOST=localhost -DB_USER=root +DB_USER=user DB_DRIVER=mysql -DB_PASSWORD=123edsaqw -DB_NAME=mfw -DB_CHARSET=utf8 -DB_COLLATION=utf8_unicode_ci +DB_PASSWORD=password +DB_NAME=name +DB_CHARSET=utf8mb4 +DB_COLLATION=utf8mb4_unicode_ci DB_PREFIX='' VIEWS_PATH=/views VIEWS_CACHE_PATH=/views_cache -MODULE_SHOP_URL='http://localhost:8383/api' -MODULE_SHOP_TOKEN='eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.W10.Sisyc1bgy03TI0wT11oKhgh5J6vR9XWDOV56L6BiTJY' +MODULE_SHOP_URL='http://igfs.loc' +MODULE_SHOP_TOKEN='your token' SECRET_KEY='' \ No newline at end of file diff --git a/app/modules/slider/SliderModule.php b/app/modules/slider/SliderModule.php deleted file mode 100644 index 41839b5..0000000 --- a/app/modules/slider/SliderModule.php +++ /dev/null @@ -1,38 +0,0 @@ -menuService = new MenuService(); - $this->migrationService = new MigrationService(); - } - - /** - * @throws \Exception - */ - public function init(): void - { - $this->migrationService->runAtPath("{KERNEL_APP_MODULES}/slider/migrations"); - - $this->menuService->createItem([ - "label" => "Слайдер", - "url" => "/admin/slider", - "slug" => "slider", - ]); - } - - public function deactivate(): void - { - $this->menuService->removeItemBySlug("slider"); - } -} \ No newline at end of file diff --git a/app/modules/slider/controllers/SliderController.php b/app/modules/slider/controllers/SliderController.php deleted file mode 100644 index a2f5226..0000000 --- a/app/modules/slider/controllers/SliderController.php +++ /dev/null @@ -1,35 +0,0 @@ -cgView->viewPath = KERNEL_APP_MODULES_DIR . "/photo/views/"; - } - - - public function actionIndex($page_number = 1): void - { - $this->cgView->render("index.php", ['page_number' => $page_number]); - } - - /** - * @throws Exception - */ - public function actionView($id): void - { - $slide = Slider::find($id); - - if (!$slide){ - throw new Exception(message: "The slide not found"); - } - $this->cgView->render("view.php", ['slider' => $slide]); - } -} \ No newline at end of file diff --git a/app/modules/slider/manifest.json b/app/modules/slider/manifest.json deleted file mode 100644 index 65a4bfe..0000000 --- a/app/modules/slider/manifest.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "name": "Slider", - "version": "0.1", - "author": "ITGuild", - "slug": "slider", - "type": "entity", - "description": "Slider module", - "app_module_path": "{APP}/modules/{slug}", - "module_class": "app\\modules\\slider\\SliderModule", - "module_class_file": "{APP}/modules/slider/SliderModule.php", - "routs": "routs/slider.php", - "dependence": "menu, user" -} diff --git a/app/modules/slider/migrations/2024_12_03_124749_create_slider_table.php b/app/modules/slider/migrations/2024_12_03_124749_create_slider_table.php deleted file mode 100644 index 0761ec2..0000000 --- a/app/modules/slider/migrations/2024_12_03_124749_create_slider_table.php +++ /dev/null @@ -1,31 +0,0 @@ -schema->create('slider', function (Blueprint $table) { - $table->increments('id'); - $table->string('title', 255)->nullable(false); - $table->string('additional_information', 255)->nullable(false); - $table->string('content', 255)->nullable(false); - $table->integer('status')->default(0); - $table->timestamps(); - }); - } - - /** - * Reverse the migrations. - */ - public function down(): void - { - \kernel\App::$db->schema->dropIfExists('slider'); - } -}; diff --git a/app/modules/slider/models/Slider.php b/app/modules/slider/models/Slider.php deleted file mode 100644 index d960dcf..0000000 --- a/app/modules/slider/models/Slider.php +++ /dev/null @@ -1,39 +0,0 @@ - 'Заголовок', - 'additional_information' => 'Дополнительная информация', - 'content' => 'Контент' - ]; - } - - public static function getStatus(): array - { - return [ - self::DISABLE_STATUS => "Не активный", - self::ACTIVE_STATUS => "Активный", - ]; - } - -} \ No newline at end of file diff --git a/app/modules/slider/routs/slider.php b/app/modules/slider/routs/slider.php deleted file mode 100644 index b25a24c..0000000 --- a/app/modules/slider/routs/slider.php +++ /dev/null @@ -1,20 +0,0 @@ -group(["prefix" => "admin"], function (CgRouteCollector $router) { - App::$collector->group(["before" => "auth"], function (RouteCollector $router) { - App::$collector->group(["prefix" => "slider"], function (CGRouteCollector $router) { - App::$collector->get('/', [\app\modules\slider\controllers\SliderController::class, 'actionIndex']); - App::$collector->get('/page/{page_number}', [\app\modules\slider\controllers\SliderController::class, 'actionIndex']); - App::$collector->get('/create', [\app\modules\slider\controllers\SliderController::class, 'actionCreate']); - App::$collector->post("/", [\app\modules\slider\controllers\SliderController::class, 'actionAdd']); - App::$collector->get('/view/{id}', [\app\modules\slider\controllers\SliderController::class, 'actionView']); - App::$collector->any('/update/{id}', [\app\modules\slider\controllers\SliderController::class, 'actionUpdate']); - App::$collector->any("/edit/{id}", [\app\modules\slider\controllers\SliderController::class, 'actionEdit']); - App::$collector->get('/delete/{id}', [\app\modules\slider\controllers\SliderController::class]); - }); - }); -}); \ No newline at end of file diff --git a/app/modules/slider/views/index.php b/app/modules/slider/views/index.php deleted file mode 100644 index e652162..0000000 --- a/app/modules/slider/views/index.php +++ /dev/null @@ -1,43 +0,0 @@ - $page_number, - 'perPage' => 8, - 'params' => ["class" => "table table-bordered", "border" => "2"], - 'baseUrl' => "/admin/photo", -])); - -$table->beforePrint(function () { - return IconBtnCreateWidget::create(['url' => '/admin/slider/create'])->run(); -}); - -$table->columns([ - "status" => [ - "value" => function ($cell) { - return Slider::getStatus()[$cell]; - }] -]); - -$table->addAction(function($row) { - return IconBtnViewWidget::create(['url' => '/admin/slider/view/' . $row['id']])->run(); -}); -$table->addAction(function($row) { - return IconBtnEditWidget::create(['url' => '/admin/slider/update/' . $row['id']])->run(); -}); -$table->addAction(function($row) { - return IconBtnDeleteWidget::create(['url' => '/admin/slider/delete/' . $row['id']])->run(); -}); -$table->create(); -$table->render(); \ No newline at end of file diff --git a/app/modules/slider/views/view.php b/app/modules/slider/views/view.php deleted file mode 100644 index 8c799f6..0000000 --- a/app/modules/slider/views/view.php +++ /dev/null @@ -1,29 +0,0 @@ - ["class" => "table table-bordered", "border" => "2"], - 'baseUrl' => "/admin/slider", -])); -$table->beforePrint(function () use ($slider) { - $btn = PrimaryBtn::create("Список", "/admin/slider")->fetch(); - $btn .= SuccessBtn::create("Редактировать", "/admin/slider/update/" . $slider->id)->fetch(); - $btn .= DangerBtn::create("Удалить", "/admin/slider/delete/" . $slider->id)->fetch(); - return $btn; -}); -$table->rows([ - 'status' => (function ($data) { - return \app\modules\slider\models\Slider::getStatus()[$data]; - }) -]); -$table->create(); -$table->render(); \ No newline at end of file diff --git a/kernel/console/controllers/AdminConsoleController.php b/kernel/console/controllers/AdminConsoleController.php index b94b994..bce72d6 100644 --- a/kernel/console/controllers/AdminConsoleController.php +++ b/kernel/console/controllers/AdminConsoleController.php @@ -136,7 +136,7 @@ class AdminConsoleController extends ConsoleController "slug" => "menu", "parent_slug" => "settings" ]); - $this->out->r("create item menu admin-themes", "green"); + $this->out->r("create item menu menu", "green"); $this->menuService->createItem([ "label" => "Опции", diff --git a/kernel/services/ModuleService.php b/kernel/services/ModuleService.php index 6a8b01c..c112e2f 100644 --- a/kernel/services/ModuleService.php +++ b/kernel/services/ModuleService.php @@ -113,7 +113,7 @@ class ModuleService if (isset($module_info['dependence'])) { $dependence_array = explode(',', $module_info['dependence']); foreach ($dependence_array as $depend) { - if (!in_array($depend, $active_modules->modules)) { + if (!in_array(trim($depend), $active_modules->modules)) { $this->addError("first activate the $depend module"); return false; }