From 0e0bc8026047cdae8fe9c28cb95a2511688a3ed3 Mon Sep 17 00:00:00 2001 From: stasbilay02 Date: Mon, 9 Dec 2024 16:26:12 +0300 Subject: [PATCH] slider module move to app_modules --- .../slider/SliderModule.php | 2 +- .../slider/controllers/SliderController.php | 8 ++++---- .../slider/manifest.json | 4 ++-- .../2024_12_03_124749_create_slider_table.php | 0 .../slider/models/Slider.php | 2 +- .../slider/models/forms/CreateSliderForm.php | 2 +- kernel/app_modules/slider/routs/slider.php | 20 +++++++++++++++++++ .../slider/services/SliderService.php | 4 ++-- .../slider/views/form.php | 2 +- .../slider/views/index.php | 2 +- .../slider/views/view.php | 2 +- kernel/modules/slider/routs/slider.php | 20 ------------------- 12 files changed, 34 insertions(+), 34 deletions(-) rename kernel/{modules => app_modules}/slider/SliderModule.php (89%) rename kernel/{modules => app_modules}/slider/controllers/SliderController.php (93%) rename kernel/{modules => app_modules}/slider/manifest.json (63%) rename kernel/{modules => app_modules}/slider/migrations/2024_12_03_124749_create_slider_table.php (100%) rename kernel/{modules => app_modules}/slider/models/Slider.php (95%) rename kernel/{modules => app_modules}/slider/models/forms/CreateSliderForm.php (87%) create mode 100644 kernel/app_modules/slider/routs/slider.php rename kernel/{modules => app_modules}/slider/services/SliderService.php (91%) rename kernel/{modules => app_modules}/slider/views/form.php (98%) rename kernel/{modules => app_modules}/slider/views/index.php (95%) rename kernel/{modules => app_modules}/slider/views/view.php (90%) delete mode 100644 kernel/modules/slider/routs/slider.php diff --git a/kernel/modules/slider/SliderModule.php b/kernel/app_modules/slider/SliderModule.php similarity index 89% rename from kernel/modules/slider/SliderModule.php rename to kernel/app_modules/slider/SliderModule.php index b8e1ed1..ada5bb4 100644 --- a/kernel/modules/slider/SliderModule.php +++ b/kernel/app_modules/slider/SliderModule.php @@ -22,7 +22,7 @@ class SliderModule extends Module */ public function init(): void { - $this->migrationService->runAtPath("{KERNEL_MODULES}/slider/migrations"); + $this->migrationService->runAtPath("{KERNEL_APP_MODULES}/slider/migrations"); $this->menuService->createItem([ "label" => "Слайдер", diff --git a/kernel/modules/slider/controllers/SliderController.php b/kernel/app_modules/slider/controllers/SliderController.php similarity index 93% rename from kernel/modules/slider/controllers/SliderController.php rename to kernel/app_modules/slider/controllers/SliderController.php index ca60934..70617a6 100644 --- a/kernel/modules/slider/controllers/SliderController.php +++ b/kernel/app_modules/slider/controllers/SliderController.php @@ -1,11 +1,11 @@ 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('/', [\kernel\app_modules\slider\controllers\SliderController::class, 'actionIndex']); + App::$collector->get('/page/{page_number}', [\kernel\app_modules\slider\controllers\SliderController::class, 'actionIndex']); + App::$collector->get('/create', [\kernel\app_modules\slider\controllers\SliderController::class, 'actionCreate']); + App::$collector->post("/", [\kernel\app_modules\slider\controllers\SliderController::class, 'actionAdd']); + App::$collector->get('/view/{id}', [\kernel\app_modules\slider\controllers\SliderController::class, 'actionView']); + App::$collector->any('/update/{id}', [\kernel\app_modules\slider\controllers\SliderController::class, 'actionUpdate']); + App::$collector->any("/edit/{id}", [\kernel\app_modules\slider\controllers\SliderController::class, 'actionEdit']); + App::$collector->get('/delete/{id}', [\kernel\app_modules\slider\controllers\SliderController::class, 'actionDelete']); + }); + }); +}); \ No newline at end of file diff --git a/kernel/modules/slider/services/SliderService.php b/kernel/app_modules/slider/services/SliderService.php similarity index 91% rename from kernel/modules/slider/services/SliderService.php rename to kernel/app_modules/slider/services/SliderService.php index cdbf335..1298ba8 100644 --- a/kernel/modules/slider/services/SliderService.php +++ b/kernel/app_modules/slider/services/SliderService.php @@ -1,8 +1,8 @@ beginForm(isset($model) ? "/admin/slider/edit/" . $model->id : "/admin/slider", 'multipart/form-data'); diff --git a/kernel/modules/slider/views/index.php b/kernel/app_modules/slider/views/index.php similarity index 95% rename from kernel/modules/slider/views/index.php rename to kernel/app_modules/slider/views/index.php index 1952757..409ef5c 100644 --- a/kernel/modules/slider/views/index.php +++ b/kernel/app_modules/slider/views/index.php @@ -3,7 +3,7 @@ * @var int $page_number */ -use kernel\modules\slider\models\Slider; +use kernel\app_modules\slider\models\Slider; use Itguild\EloquentTable\EloquentDataProvider; use Itguild\EloquentTable\ListEloquentTable; use kernel\app_modules\photo\models\Photo; diff --git a/kernel/modules/slider/views/view.php b/kernel/app_modules/slider/views/view.php similarity index 90% rename from kernel/modules/slider/views/view.php rename to kernel/app_modules/slider/views/view.php index 39c7289..91bc9cd 100644 --- a/kernel/modules/slider/views/view.php +++ b/kernel/app_modules/slider/views/view.php @@ -22,7 +22,7 @@ $table->beforePrint(function () use ($slider) { }); $table->rows([ 'status' => (function ($data) { - return \kernel\modules\slider\models\Slider::getStatus()[$data]; + return \kernel\app_modules\slider\models\Slider::getStatus()[$data]; }) ]); $table->create(); diff --git a/kernel/modules/slider/routs/slider.php b/kernel/modules/slider/routs/slider.php deleted file mode 100644 index 703138a..0000000 --- a/kernel/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('/', [\kernel\modules\slider\controllers\SliderController::class, 'actionIndex']); - App::$collector->get('/page/{page_number}', [\kernel\modules\slider\controllers\SliderController::class, 'actionIndex']); - App::$collector->get('/create', [\kernel\modules\slider\controllers\SliderController::class, 'actionCreate']); - App::$collector->post("/", [\kernel\modules\slider\controllers\SliderController::class, 'actionAdd']); - App::$collector->get('/view/{id}', [\kernel\modules\slider\controllers\SliderController::class, 'actionView']); - App::$collector->any('/update/{id}', [\kernel\modules\slider\controllers\SliderController::class, 'actionUpdate']); - App::$collector->any("/edit/{id}", [\kernel\modules\slider\controllers\SliderController::class, 'actionEdit']); - App::$collector->get('/delete/{id}', [\kernel\modules\slider\controllers\SliderController::class, 'actionDelete']); - }); - }); -}); \ No newline at end of file