Skip to content

Commit

Permalink
- wip
Browse files Browse the repository at this point in the history
  • Loading branch information
EwelinaSkrzypacz committed Oct 11, 2024
1 parent 7641d4c commit 83c388c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 9 deletions.
8 changes: 3 additions & 5 deletions app/Http/Controllers/NewsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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();
Expand Down Expand Up @@ -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);
}
Expand Down
2 changes: 1 addition & 1 deletion database/seeders/LocalEnvironmentSeeder.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down
6 changes: 3 additions & 3 deletions resources/views/single-news.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,10 @@ class="w-full h-auto xl:h-[343px] object-cover aspect-square xl:aspect-auto">
<a href="{{ route('news', ['tag' => $tag]) }}"
class="flex justify-between py-3 font-light hover:text-website-normal hover:font-normal">
<span>
{{ $tag['title'] }}
{{ $tag }}
</span>
<span>
{{ $tagsNewsCount[$tag['title']] }}
{{ $tagsNewsCount[$tag] }}
</span>
</a>
@endforeach
Expand All @@ -92,7 +92,7 @@ class="flex justify-between py-3 font-light hover:text-website-normal hover:font
@foreach($peopleTags as $tag)
<a href="{{ route('news', ['tag' => $tag]) }}">
<span class="capitalize justify-between font-light text-sm text-gray-500 border border-gray-300 w-fit px-3 py-2 rounded-md">
{{ $tag['title'] }}
{{ $tag }}
</span>
</a>
@endforeach
Expand Down

0 comments on commit 83c388c

Please sign in to comment.