tag settings
This commit is contained in:
@ -111,32 +111,32 @@ class TagController extends AdminController
|
||||
$request = new Request();
|
||||
$entities = $request->post('entity');
|
||||
|
||||
$entityRelationsModel = Option::where("key", "entity_relations")->first();
|
||||
$entityRelations = json_decode($entityRelationsModel->value, true);
|
||||
|
||||
|
||||
|
||||
Debug::prn($entities);
|
||||
Debug::prn($entityRelations);
|
||||
|
||||
$entityRelations = EntityRelation::getEntitiesRelations();
|
||||
|
||||
if (isset($entities)) {
|
||||
foreach ($entities as $entity) {
|
||||
if (!isset($entityRelations[$entity])) {
|
||||
EntityRelation::addEntityRelation($entity, 'tag');
|
||||
}
|
||||
}
|
||||
foreach ($entityRelations as $entity => $property) {
|
||||
if (in_array($entity, $entities)) {
|
||||
if (!in_array('tag', $property)) {
|
||||
EntityRelation::addEntityRelation($entity, 'tag');
|
||||
}
|
||||
} else {
|
||||
EntityRelation::removePropertyFromEntityRelations($entity, array_search('tag', $property));
|
||||
if (in_array('tag', $property)) {
|
||||
EntityRelation::removePropertyFromEntityRelations($entity, 'tag');
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
foreach ($entityRelations as $entity => $property) {
|
||||
EntityRelation::removeEntityRelation($entity);
|
||||
EntityRelation::removePropertyFromEntityRelations($entity, 'tag');
|
||||
}
|
||||
}
|
||||
|
||||
// $this->redirect("/admin/settings/tag");
|
||||
$this->redirect("/admin/settings/tag", 302);
|
||||
}
|
||||
|
||||
}
|
@ -1,14 +1,13 @@
|
||||
<?php
|
||||
|
||||
use itguild\forms\builders\SelectBuilder;
|
||||
use kernel\EntityRelation;
|
||||
|
||||
$form = new \itguild\forms\ActiveForm();
|
||||
$form->beginForm("/admin/settings/tag/update");
|
||||
|
||||
//\kernel\helpers\Debug::dd($value);
|
||||
|
||||
$form->field(\itguild\forms\inputs\Select::class, "entity[]", [
|
||||
'class' => "form-control",
|
||||
'value' => $model->entity ?? '',
|
||||
'value' => \kernel\EntityRelation::getEntityByProperty('tag') ?? '',
|
||||
'multiple' => "multiple",
|
||||
|
||||
])
|
||||
|
Reference in New Issue
Block a user