Skip to content

Commit 652edf8

Browse files
committed
feat: bootstrap 5 pagination
1 parent 32ba621 commit 652edf8

File tree

1 file changed

+57
-0
lines changed

1 file changed

+57
-0
lines changed
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
@if($paginator->count())
2+
<div class="d-flex justify-content-between align-items-center">
3+
<div class="text-muted">
4+
{{ trans_choice(__('Showing :count from total :total entry|Showing :count from total :total entries',
5+
['count' => $paginator->count(),
6+
'total' => $paginator->total()]
7+
), $paginator->total()) }}
8+
</div>
9+
</div>
10+
@endif
11+
12+
@if ($paginator->hasPages())
13+
<nav>
14+
<ul class="pagination">
15+
{{-- Previous Page Link --}}
16+
@if ($paginator->onFirstPage())
17+
<li class="page-item disabled" aria-disabled="true" aria-label="@lang('pagination.previous')">
18+
<span class="page-link" aria-hidden="true">&lsaquo;</span>
19+
</li>
20+
@else
21+
<li class="page-item">
22+
<a class="page-link" href="{{ $paginator->previousPageUrl() }}" rel="prev" aria-label="@lang('pagination.previous')">&lsaquo;</a>
23+
</li>
24+
@endif
25+
26+
{{-- Pagination Elements --}}
27+
@foreach ($elements as $element)
28+
{{-- "Three Dots" Separator --}}
29+
@if (is_string($element))
30+
<li class="page-item disabled" aria-disabled="true"><span class="page-link">{{ $element }}</span></li>
31+
@endif
32+
33+
{{-- Array Of Links --}}
34+
@if (is_array($element))
35+
@foreach ($element as $page => $url)
36+
@if ($page == $paginator->currentPage())
37+
<li class="page-item active" aria-current="page"><span class="page-link">{{ $page }}</span></li>
38+
@else
39+
<li class="page-item"><a class="page-link" href="{{ $url }}">{{ $page }}</a></li>
40+
@endif
41+
@endforeach
42+
@endif
43+
@endforeach
44+
45+
{{-- Next Page Link --}}
46+
@if ($paginator->hasMorePages())
47+
<li class="page-item">
48+
<a class="page-link" href="{{ $paginator->nextPageUrl() }}" rel="next" aria-label="@lang('pagination.next')">&rsaquo;</a>
49+
</li>
50+
@else
51+
<li class="page-item disabled" aria-disabled="true" aria-label="@lang('pagination.next')">
52+
<span class="page-link" aria-hidden="true">&rsaquo;</span>
53+
</li>
54+
@endif
55+
</ul>
56+
</nav>
57+
@endif

0 commit comments

Comments
 (0)