From 1c410ce074ffdf46aa1773424d844bdf913d171e Mon Sep 17 00:00:00 2001 From: Annika Backstrom Date: Thu, 30 May 2024 21:56:21 +0100 Subject: [PATCH] Paginate bookmarks on tag permalink --- app/Http/Controllers/TagController.php | 4 +++- resources/views/tag/show.blade.php | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/app/Http/Controllers/TagController.php b/app/Http/Controllers/TagController.php index 047fe68..323526d 100644 --- a/app/Http/Controllers/TagController.php +++ b/app/Http/Controllers/TagController.php @@ -2,6 +2,7 @@ namespace App\Http\Controllers; +use App\Models\Bookmark; use App\Models\Tag; use Illuminate\Http\Request; @@ -38,8 +39,9 @@ class TagController extends Controller { return view( 'tag.show', [ - 'tag' => $tag->load('bookmarks'), + 'tag' => $tag, 'tag_count' => $tag->bookmarks()->count(), + 'bookmarks' => $tag->bookmarks()->latest()->paginate(20), ] ); } diff --git a/resources/views/tag/show.blade.php b/resources/views/tag/show.blade.php index 09c281a..a83b064 100644 --- a/resources/views/tag/show.blade.php +++ b/resources/views/tag/show.blade.php @@ -2,9 +2,11 @@ @section('content')

Tag: {{ $tag->name }} ({{ $tag_count }})

+ {{ $bookmarks->links() }}
- @foreach ($tag->bookmarks as $bookmark) + @foreach ($bookmarks as $bookmark) @endforeach
+ {{ $bookmarks->links() }} @endsection