Paginate bookmarks on tag permalink

This commit is contained in:
Annika Backstrom 2024-05-30 21:56:21 +01:00
parent a0f116c7a3
commit 1c410ce074
Signed by: annika
GPG Key ID: 3561F004DE1D9AFE
2 changed files with 6 additions and 2 deletions

View File

@ -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),
]
);
}

View File

@ -2,9 +2,11 @@
@section('content')
<h2>Tag: {{ $tag->name }} ({{ $tag_count }})</h2>
{{ $bookmarks->links() }}
<div>
@foreach ($tag->bookmarks as $bookmark)
@foreach ($bookmarks as $bookmark)
<x-bookmark :bookmark="$bookmark" />
@endforeach
</div>
{{ $bookmarks->links() }}
@endsection