From 83c388cc642cee169ac9d611bd19e6b5a4ff2fa1 Mon Sep 17 00:00:00 2001 From: EwelinaSkrzypacz Date: Fri, 11 Oct 2024 08:57:36 +0200 Subject: [PATCH] - wip --- app/Http/Controllers/NewsController.php | 8 +++----- database/seeders/LocalEnvironmentSeeder.php | 2 +- resources/views/single-news.blade.php | 6 +++--- 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/app/Http/Controllers/NewsController.php b/app/Http/Controllers/NewsController.php index 6632e5c0..0e34eacc 100644 --- a/app/Http/Controllers/NewsController.php +++ b/app/Http/Controllers/NewsController.php @@ -5,7 +5,6 @@ namespace Blumilk\Website\Http\Controllers; use Blumilk\Website\Http\Resources\NewsResource; -use Blumilk\Website\Http\Resources\TagResource; use Blumilk\Website\Models\News; use Blumilk\Website\Models\Tag; use Illuminate\Contracts\View\Factory; @@ -30,8 +29,7 @@ public function index(Request $request, Factory $factory): View ->where("published", true) ->when($tag, fn($query, $tag) => $query->whereJsonContains("tags", $tag->id)) ->latest("published_at") - ->paginate(7) - ->appends(["tag" => $tagFromQuery]); + ->paginate(7); $tags = Tag::query() ->where("is_primary", true) ->get(); @@ -81,9 +79,9 @@ public function get(Request $request, Factory $factory, string $slug): View return $factory->make("single-news") ->with("news", $news->resolve()) - ->with("tags", TagResource::collection($newsTags->where("as_person", false))->resolve()) + ->with("tags", $newsTags->where("as_person", false)->pluck("title")) ->with("tagsNewsCount", $tagsNewsCount) - ->with("peopleTags", TagResource::collection($newsTags->where("as_person", true))->resolve()) + ->with("peopleTags", $newsTags->where("as_person", true)->pluck("title")) ->with("recommendedNews", NewsResource::collection($recommendedNews)->resolve()) ->with("articleUrl", $articleUrl); } diff --git a/database/seeders/LocalEnvironmentSeeder.php b/database/seeders/LocalEnvironmentSeeder.php index 08aabc9d..80b99710 100644 --- a/database/seeders/LocalEnvironmentSeeder.php +++ b/database/seeders/LocalEnvironmentSeeder.php @@ -22,7 +22,7 @@ public function run(): void $this->call(ProjectsSeeder::class); Tag::factory()->count(12)->create(); - News::factory()->count(12)->create(); + News::factory()->count(70)->create(); ContactForm::factory()->count(12)->create(); Reference::factory()->count(12)->create(); } diff --git a/resources/views/single-news.blade.php b/resources/views/single-news.blade.php index 80bca706..34746f40 100644 --- a/resources/views/single-news.blade.php +++ b/resources/views/single-news.blade.php @@ -77,10 +77,10 @@ class="w-full h-auto xl:h-[343px] object-cover aspect-square xl:aspect-auto"> - {{ $tag['title'] }} + {{ $tag }} - {{ $tagsNewsCount[$tag['title']] }} + {{ $tagsNewsCount[$tag] }} @endforeach @@ -92,7 +92,7 @@ class="flex justify-between py-3 font-light hover:text-website-normal hover:font @foreach($peopleTags as $tag) - {{ $tag['title'] }} + {{ $tag }} @endforeach