get additional property

This commit is contained in:
2024-11-28 12:15:30 +03:00
parent 2133fae2cc
commit 44e61a2030
4 changed files with 109 additions and 94 deletions

View File

@ -87,8 +87,14 @@ class TagModule extends Module
}
public function getItems(string $entity, Model $model): array
public function getItems(string $entity, Model $model): array|string
{
return TagEntity::where("entity", $entity)->where("entity_id", $model->id)->with("tag")->get()->toArray();
$tags = TagEntity::where("entity", $entity)->where("entity_id", $model->id)->with("tag")->get();
$tagsStr = "";
foreach ($tags as $tag) {
$tagsStr .= $tag->tag->label . ", ";
}
return substr($tagsStr, 0, -2);
}
}