entyy_id add to tag migration
This commit is contained in:
parent
62eff81213
commit
1bc7662be0
@ -52,6 +52,8 @@ class TagModule extends Module
|
|||||||
{
|
{
|
||||||
$model = new Tag();
|
$model = new Tag();
|
||||||
$model->entity = $entity;
|
$model->entity = $entity;
|
||||||
|
Debug::dd($request->post());
|
||||||
|
$model->entity_id = 1;
|
||||||
$model->label = $request->post('tag');
|
$model->label = $request->post('tag');
|
||||||
$model->status = Tag::ACTIVE_STATUS;
|
$model->status = Tag::ACTIVE_STATUS;
|
||||||
$model->slug = Slug::createSlug($request->post('tag'), $model);
|
$model->slug = Slug::createSlug($request->post('tag'), $model);
|
||||||
|
0
kernel/app_modules/tag/controllers/TagController.php
Normal file → Executable file
0
kernel/app_modules/tag/controllers/TagController.php
Normal file → Executable file
1
kernel/app_modules/tag/migrations/2024_10_08_093710_create_tag_table.php
Normal file → Executable file
1
kernel/app_modules/tag/migrations/2024_10_08_093710_create_tag_table.php
Normal file → Executable file
@ -15,6 +15,7 @@ return new class extends Migration
|
|||||||
$table->increments('id');
|
$table->increments('id');
|
||||||
$table->string('label', 255)->nullable(false);
|
$table->string('label', 255)->nullable(false);
|
||||||
$table->string('entity', 255)->nullable(false);
|
$table->string('entity', 255)->nullable(false);
|
||||||
|
$table->string('entity_id', 255)->nullable(false);
|
||||||
$table->string('slug', 255)->unique();
|
$table->string('slug', 255)->unique();
|
||||||
$table->integer('status')->default(1);
|
$table->integer('status')->default(1);
|
||||||
$table->timestamps();
|
$table->timestamps();
|
||||||
|
1
kernel/app_modules/tag/models/Tag.php
Normal file → Executable file
1
kernel/app_modules/tag/models/Tag.php
Normal file → Executable file
@ -8,6 +8,7 @@ use Illuminate\Database\Eloquent\Model;
|
|||||||
* @property int $id
|
* @property int $id
|
||||||
* @property string $label
|
* @property string $label
|
||||||
* @property string $entity
|
* @property string $entity
|
||||||
|
* @property int $entity_id
|
||||||
* @property string $slug
|
* @property string $slug
|
||||||
* @property int $status
|
* @property int $status
|
||||||
* @method static where(int[] $array)
|
* @method static where(int[] $array)
|
||||||
|
1
kernel/app_modules/tag/models/forms/CreateTagForm.php
Normal file → Executable file
1
kernel/app_modules/tag/models/forms/CreateTagForm.php
Normal file → Executable file
@ -12,6 +12,7 @@ class CreateTagForm extends FormModel
|
|||||||
return [
|
return [
|
||||||
'label' => 'required|min-str-len:5|max-str-len:30',
|
'label' => 'required|min-str-len:5|max-str-len:30',
|
||||||
'entity' => 'required|min-str-len:1|max-str-len:50',
|
'entity' => 'required|min-str-len:1|max-str-len:50',
|
||||||
|
'entity_id' => 'required',
|
||||||
'slug' => '',
|
'slug' => '',
|
||||||
'status' => ''
|
'status' => ''
|
||||||
];
|
];
|
||||||
|
0
kernel/app_modules/tag/routs/tag.php
Normal file → Executable file
0
kernel/app_modules/tag/routs/tag.php
Normal file → Executable file
2
kernel/app_modules/tag/services/TagService.php
Normal file → Executable file
2
kernel/app_modules/tag/services/TagService.php
Normal file → Executable file
@ -14,6 +14,7 @@ class TagService
|
|||||||
$model = new Tag();
|
$model = new Tag();
|
||||||
$model->label = $form_model->getItem('label');
|
$model->label = $form_model->getItem('label');
|
||||||
$model->entity = $form_model->getItem('entity');
|
$model->entity = $form_model->getItem('entity');
|
||||||
|
$model->entity_id = $form_model->getItem('entity_id');
|
||||||
$model->status = $form_model->getItem('status');
|
$model->status = $form_model->getItem('status');
|
||||||
$model->slug = Slug::createSlug($form_model->getItem('label'), Tag::class);
|
$model->slug = Slug::createSlug($form_model->getItem('label'), Tag::class);
|
||||||
if ($model->save()){
|
if ($model->save()){
|
||||||
@ -30,6 +31,7 @@ class TagService
|
|||||||
}
|
}
|
||||||
$tag->label = $form_model->getItem('label');
|
$tag->label = $form_model->getItem('label');
|
||||||
$tag->entity = $form_model->getItem('entity');
|
$tag->entity = $form_model->getItem('entity');
|
||||||
|
$tag->entity_id = $form_model->getItem('entity_id');
|
||||||
$tag->status = $form_model->getItem('status');
|
$tag->status = $form_model->getItem('status');
|
||||||
|
|
||||||
if ($tag->save()){
|
if ($tag->save()){
|
||||||
|
0
kernel/app_modules/tag/views/form.php
Normal file → Executable file
0
kernel/app_modules/tag/views/form.php
Normal file → Executable file
0
kernel/app_modules/tag/views/index.php
Normal file → Executable file
0
kernel/app_modules/tag/views/index.php
Normal file → Executable file
0
kernel/app_modules/tag/views/view.php
Normal file → Executable file
0
kernel/app_modules/tag/views/view.php
Normal file → Executable file
@ -74,6 +74,13 @@ class AdminConsoleController extends ConsoleController
|
|||||||
);
|
);
|
||||||
$this->out->r("create option active_modules", "green");
|
$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([
|
$this->menuService->createItem([
|
||||||
"label" => "Модули",
|
"label" => "Модули",
|
||||||
"url" => "/admin",
|
"url" => "/admin",
|
||||||
@ -116,6 +123,14 @@ class AdminConsoleController extends ConsoleController
|
|||||||
]);
|
]);
|
||||||
$this->out->r("create item menu admin-themes", "green");
|
$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 = new CreateUserForm();
|
||||||
$user->load([
|
$user->load([
|
||||||
'username' => 'admin',
|
'username' => 'admin',
|
||||||
|
Loading…
Reference in New Issue
Block a user