From 1bc7662be0ef4d15564f5f407531288a05d5fca8 Mon Sep 17 00:00:00 2001 From: stasbilay02 Date: Thu, 21 Nov 2024 15:53:52 +0300 Subject: [PATCH] entyy_id add to tag migration --- app/modules/tag/TagModule.php | 2 ++ .../app_modules/tag/controllers/TagController.php | 0 .../2024_10_08_093710_create_tag_table.php | 1 + kernel/app_modules/tag/models/Tag.php | 1 + .../tag/models/forms/CreateTagForm.php | 1 + kernel/app_modules/tag/routs/tag.php | 0 kernel/app_modules/tag/services/TagService.php | 2 ++ kernel/app_modules/tag/views/form.php | 0 kernel/app_modules/tag/views/index.php | 0 kernel/app_modules/tag/views/view.php | 0 .../controllers/AdminConsoleController.php | 15 +++++++++++++++ 11 files changed, 22 insertions(+) mode change 100644 => 100755 kernel/app_modules/tag/controllers/TagController.php mode change 100644 => 100755 kernel/app_modules/tag/migrations/2024_10_08_093710_create_tag_table.php mode change 100644 => 100755 kernel/app_modules/tag/models/Tag.php mode change 100644 => 100755 kernel/app_modules/tag/models/forms/CreateTagForm.php mode change 100644 => 100755 kernel/app_modules/tag/routs/tag.php mode change 100644 => 100755 kernel/app_modules/tag/services/TagService.php mode change 100644 => 100755 kernel/app_modules/tag/views/form.php mode change 100644 => 100755 kernel/app_modules/tag/views/index.php mode change 100644 => 100755 kernel/app_modules/tag/views/view.php diff --git a/app/modules/tag/TagModule.php b/app/modules/tag/TagModule.php index 5f6a05f..2438479 100644 --- a/app/modules/tag/TagModule.php +++ b/app/modules/tag/TagModule.php @@ -52,6 +52,8 @@ class TagModule extends Module { $model = new Tag(); $model->entity = $entity; + Debug::dd($request->post()); + $model->entity_id = 1; $model->label = $request->post('tag'); $model->status = Tag::ACTIVE_STATUS; $model->slug = Slug::createSlug($request->post('tag'), $model); diff --git a/kernel/app_modules/tag/controllers/TagController.php b/kernel/app_modules/tag/controllers/TagController.php old mode 100644 new mode 100755 diff --git a/kernel/app_modules/tag/migrations/2024_10_08_093710_create_tag_table.php b/kernel/app_modules/tag/migrations/2024_10_08_093710_create_tag_table.php old mode 100644 new mode 100755 index 37c4be5..84f49d9 --- a/kernel/app_modules/tag/migrations/2024_10_08_093710_create_tag_table.php +++ b/kernel/app_modules/tag/migrations/2024_10_08_093710_create_tag_table.php @@ -15,6 +15,7 @@ return new class extends Migration $table->increments('id'); $table->string('label', 255)->nullable(false); $table->string('entity', 255)->nullable(false); + $table->string('entity_id', 255)->nullable(false); $table->string('slug', 255)->unique(); $table->integer('status')->default(1); $table->timestamps(); diff --git a/kernel/app_modules/tag/models/Tag.php b/kernel/app_modules/tag/models/Tag.php old mode 100644 new mode 100755 index 49e1bb4..81c891a --- a/kernel/app_modules/tag/models/Tag.php +++ b/kernel/app_modules/tag/models/Tag.php @@ -8,6 +8,7 @@ use Illuminate\Database\Eloquent\Model; * @property int $id * @property string $label * @property string $entity + * @property int $entity_id * @property string $slug * @property int $status * @method static where(int[] $array) diff --git a/kernel/app_modules/tag/models/forms/CreateTagForm.php b/kernel/app_modules/tag/models/forms/CreateTagForm.php old mode 100644 new mode 100755 index 82fd893..e657ff3 --- a/kernel/app_modules/tag/models/forms/CreateTagForm.php +++ b/kernel/app_modules/tag/models/forms/CreateTagForm.php @@ -12,6 +12,7 @@ class CreateTagForm extends FormModel return [ 'label' => 'required|min-str-len:5|max-str-len:30', 'entity' => 'required|min-str-len:1|max-str-len:50', + 'entity_id' => 'required', 'slug' => '', 'status' => '' ]; diff --git a/kernel/app_modules/tag/routs/tag.php b/kernel/app_modules/tag/routs/tag.php old mode 100644 new mode 100755 diff --git a/kernel/app_modules/tag/services/TagService.php b/kernel/app_modules/tag/services/TagService.php old mode 100644 new mode 100755 index 9407f0a..c92edc4 --- a/kernel/app_modules/tag/services/TagService.php +++ b/kernel/app_modules/tag/services/TagService.php @@ -14,6 +14,7 @@ class TagService $model = new Tag(); $model->label = $form_model->getItem('label'); $model->entity = $form_model->getItem('entity'); + $model->entity_id = $form_model->getItem('entity_id'); $model->status = $form_model->getItem('status'); $model->slug = Slug::createSlug($form_model->getItem('label'), Tag::class); if ($model->save()){ @@ -30,6 +31,7 @@ class TagService } $tag->label = $form_model->getItem('label'); $tag->entity = $form_model->getItem('entity'); + $tag->entity_id = $form_model->getItem('entity_id'); $tag->status = $form_model->getItem('status'); if ($tag->save()){ diff --git a/kernel/app_modules/tag/views/form.php b/kernel/app_modules/tag/views/form.php old mode 100644 new mode 100755 diff --git a/kernel/app_modules/tag/views/index.php b/kernel/app_modules/tag/views/index.php old mode 100644 new mode 100755 diff --git a/kernel/app_modules/tag/views/view.php b/kernel/app_modules/tag/views/view.php old mode 100644 new mode 100755 diff --git a/kernel/console/controllers/AdminConsoleController.php b/kernel/console/controllers/AdminConsoleController.php index 4b1bce3..4a2b288 100644 --- a/kernel/console/controllers/AdminConsoleController.php +++ b/kernel/console/controllers/AdminConsoleController.php @@ -74,6 +74,13 @@ class AdminConsoleController extends ConsoleController ); $this->out->r("create option active_modules", "green"); + $this->optionService->createFromParams( + key: "entity_relations", + value: "{}", + label: "Свойства сущностей" + ); + $this->out->r("create option entity_relations", "green"); + $this->menuService->createItem([ "label" => "Модули", "url" => "/admin", @@ -116,6 +123,14 @@ class AdminConsoleController extends ConsoleController ]); $this->out->r("create item menu admin-themes", "green"); + $this->menuService->createItem([ + "label" => "Меню", + "url" => "/admin/settings/menu", + "slug" => "menu", + "parent_slug" => "settings" + ]); + $this->out->r("create item menu admin-themes", "green"); + $user = new CreateUserForm(); $user->load([ 'username' => 'admin',