From 7c831197790cb57613d4c73eb3f2df4d252c4820 Mon Sep 17 00:00:00 2001 From: Joe Dixon Date: Mon, 29 Jun 2020 20:41:09 +0100 Subject: [PATCH 1/4] Add link to profile --- resources/views/livewire/show-articles.blade.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/resources/views/livewire/show-articles.blade.php b/resources/views/livewire/show-articles.blade.php index 67d830cdf..cacd0eb64 100644 --- a/resources/views/livewire/show-articles.blade.php +++ b/resources/views/livewire/show-articles.blade.php @@ -27,13 +27,13 @@

- + {{ $article->author()->name() }}

From 1b8f96c6bce89e1ce52833eedb335dbf07c4a61b Mon Sep 17 00:00:00 2001 From: Joe Dixon Date: Mon, 29 Jun 2020 20:52:57 +0100 Subject: [PATCH 2/4] Remove tags of unpublished articles --- app/Http/Livewire/ShowArticles.php | 4 ++++ resources/views/livewire/show-articles.blade.php | 2 +- tests/Feature/ArticleTest.php | 14 ++++++++++++++ 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/app/Http/Livewire/ShowArticles.php b/app/Http/Livewire/ShowArticles.php index 1b24dfb74..9bfa19ea8 100644 --- a/app/Http/Livewire/ShowArticles.php +++ b/app/Http/Livewire/ShowArticles.php @@ -30,6 +30,9 @@ public function mount(): void public function render(): View { $articles = Article::published(); + $tags = Tag::whereHas('articles', function ($query) { + $query->published(); + })->orderBy('name')->get(); if ($this->tag) { $articles->forTag($this->tag); @@ -39,6 +42,7 @@ public function render(): View return view('livewire.show-articles', [ 'articles' => $articles->paginate(10), + 'tags' => $tags, 'selectedTag' => $this->tag, 'selectedSortBy' => $this->sortBy, ]); diff --git a/resources/views/livewire/show-articles.blade.php b/resources/views/livewire/show-articles.blade.php index cacd0eb64..e7accc983 100644 --- a/resources/views/livewire/show-articles.blade.php +++ b/resources/views/livewire/show-articles.blade.php @@ -82,7 +82,7 @@ - @foreach (App\Models\Tag::whereHas('articles')->orderBy('name')->get() as $tag) + @foreach ($tags as $tag)
  • + + Create Article + +