Paginate bookmarks on tag permalink
This commit is contained in:
parent
a0f116c7a3
commit
1c410ce074
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace App\Http\Controllers;
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
use App\Models\Bookmark;
|
||||||
use App\Models\Tag;
|
use App\Models\Tag;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
@ -38,8 +39,9 @@ class TagController extends Controller
|
|||||||
{
|
{
|
||||||
return view(
|
return view(
|
||||||
'tag.show', [
|
'tag.show', [
|
||||||
'tag' => $tag->load('bookmarks'),
|
'tag' => $tag,
|
||||||
'tag_count' => $tag->bookmarks()->count(),
|
'tag_count' => $tag->bookmarks()->count(),
|
||||||
|
'bookmarks' => $tag->bookmarks()->latest()->paginate(20),
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -2,9 +2,11 @@
|
|||||||
|
|
||||||
@section('content')
|
@section('content')
|
||||||
<h2>Tag: {{ $tag->name }} ({{ $tag_count }})</h2>
|
<h2>Tag: {{ $tag->name }} ({{ $tag_count }})</h2>
|
||||||
|
{{ $bookmarks->links() }}
|
||||||
<div>
|
<div>
|
||||||
@foreach ($tag->bookmarks as $bookmark)
|
@foreach ($bookmarks as $bookmark)
|
||||||
<x-bookmark :bookmark="$bookmark" />
|
<x-bookmark :bookmark="$bookmark" />
|
||||||
@endforeach
|
@endforeach
|
||||||
</div>
|
</div>
|
||||||
|
{{ $bookmarks->links() }}
|
||||||
@endsection
|
@endsection
|
||||||
|
Loading…
Reference in New Issue
Block a user