From 7fda007c1af58981420c239a64a364a5d02b2a6d Mon Sep 17 00:00:00 2001 From: HolgerHatGarKeineNode Date: Fri, 17 Mar 2023 13:41:03 +0100 Subject: [PATCH] tags creation added --- app/Http/Livewire/News/Form/NewsArticleForm.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/Http/Livewire/News/Form/NewsArticleForm.php b/app/Http/Livewire/News/Form/NewsArticleForm.php index 7aaed4e7..2261bbc3 100644 --- a/app/Http/Livewire/News/Form/NewsArticleForm.php +++ b/app/Http/Livewire/News/Form/NewsArticleForm.php @@ -63,7 +63,7 @@ class NewsArticleForm extends Component if ($this->type === 'paid') { $this->paid = true; } - if ($this->libraryItem === null) { + if (!$this->libraryItem) { $this->libraryItem = new LibraryItem([ 'type' => 'markdown_article', 'value' => '', @@ -75,6 +75,12 @@ class NewsArticleForm extends Component 'approved' => false, ]); $this->selectedTags[] = 'News'; + } else { + $this->selectedTags = $this->libraryItem->tags() + ->where('type', 'library_item') + ->get() + ->map(fn($tag) => $tag->name) + ->toArray(); } if (!$this->fromUrl) { $this->fromUrl = url()->previous();