From 85465f67c6e5b96011228a026056e8405b3985a2 Mon Sep 17 00:00:00 2001 From: Ludovic CANDELLIER Date: Wed, 22 Sep 2021 21:03:19 +0200 Subject: [PATCH] Fix tags with group name --- app/Repositories/Shop/TagGroups.php | 2 +- app/Repositories/Shop/Tags.php | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/app/Repositories/Shop/TagGroups.php b/app/Repositories/Shop/TagGroups.php index b232e7ef..bb9c2e32 100644 --- a/app/Repositories/Shop/TagGroups.php +++ b/app/Repositories/Shop/TagGroups.php @@ -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, diff --git a/app/Repositories/Shop/Tags.php b/app/Repositories/Shop/Tags.php index 0b18e52a..f360b0fd 100644 --- a/app/Repositories/Shop/Tags.php +++ b/app/Repositories/Shop/Tags.php @@ -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();