Add tags to show and index views

This commit is contained in:
Andras Bacsai
2024-02-05 09:51:44 +01:00
parent 8c60ef5bd6
commit 8b58c8f856
3 changed files with 33 additions and 14 deletions

View File

@@ -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');
}