Fix tags with group name

This commit is contained in:
Ludovic CANDELLIER
2021-09-22 21:03:19 +02:00
parent c347b7fe82
commit 85465f67c6
2 changed files with 10 additions and 1 deletions

View File

@@ -26,7 +26,7 @@ class TagGroups
foreach ($items as $group) {
$group_tags = [];
foreach ($group->tags as $tag) {
$group_tags[$tag->id] = $tag->name;
$group_tags[$tag->id] = $group->name . ' - ' . $tag->name;
}
$tags[] = [
'label' => $group->name,

View File

@@ -15,6 +15,15 @@ class Tags
return Tag::get()->pluck('name', 'id')->toArray();
}
public static function getOptionsFullName()
{
$tags = Tag::with('group')->get();
foreach ($tags as $tag) {
$data[$tag->id] = $tag->group->name . '-' . $tag->name;
}
return $data;
}
public static function getAll()
{
return Tag::orderBy('order', 'asc')->get();