From 8b58c8f856214264ddeccce02689a9bf46004a2b Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Mon, 5 Feb 2024 09:51:44 +0100 Subject: [PATCH] Add tags to show and index views --- app/Livewire/Tags/Show.php | 4 ++- resources/views/livewire/tags/index.blade.php | 17 +++++++----- resources/views/livewire/tags/show.blade.php | 26 ++++++++++++++----- 3 files changed, 33 insertions(+), 14 deletions(-) diff --git a/app/Livewire/Tags/Show.php b/app/Livewire/Tags/Show.php index 8574646d7..3bb669615 100644 --- a/app/Livewire/Tags/Show.php +++ b/app/Livewire/Tags/Show.php @@ -9,6 +9,7 @@ use Livewire\Component; class Show extends Component { + public $tags; public Tag $tag; public $applications; public $services; @@ -17,7 +18,8 @@ class Show extends Component public function mount() { - $tag = Tag::ownedByCurrentTeam()->where('name', request()->tag_name)->first(); + $this->tags = Tag::ownedByCurrentTeam()->get()->unique('name')->sortBy('name'); + $tag = $this->tags->where('name', request()->tag_name)->first(); if (!$tag) { return redirect()->route('tags.index'); } diff --git a/resources/views/livewire/tags/index.blade.php b/resources/views/livewire/tags/index.blade.php index 3f70d2d18..221e82a4a 100644 --- a/resources/views/livewire/tags/index.blade.php +++ b/resources/views/livewire/tags/index.blade.php @@ -1,11 +1,14 @@

Tags

-
Here you can see all the tags here
-
- @forelse ($tags as $tag) - {{ $tag->name }} - @empty -
No tags yet defined yet. Go to a resource and add a tag there.
- @endforelse +
+
Available tags:
+
+ @forelse ($tags as $oneTag) + {{ $oneTag->name }} + @empty +
No tags yet defined yet. Go to a resource and add a tag there.
+ @endforelse +
diff --git a/resources/views/livewire/tags/show.blade.php b/resources/views/livewire/tags/show.blade.php index ae318de1a..fc1a22313 100644 --- a/resources/views/livewire/tags/show.blade.php +++ b/resources/views/livewire/tags/show.blade.php @@ -1,30 +1,44 @@
-

Tag: {{ $tag->name }}

-
Tag details
+

Tags

-
+
+
Available tags:
+
+ @forelse ($tags as $oneTag) + {{ $oneTag->name }} + @empty +
No tags yet defined yet. Go to a resource and add a tag there.
+ @endforelse +
+
+
+

Details

- + All resources will be redeployed.