get additional property
This commit is contained in:
@ -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);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user