1
2@if ($paginator->hasPages())
3 <ul class="pager">
4
5 @if ($paginator->onFirstPage())
6 <li class="disabled"><span>← Previous</span></li>
7 @else
8 <li><a href="{{ $paginator->previousPageUrl() }}" rel="prev">← Previous</a></li>
9 @endif
10
11
12
13 @foreach ($elements as $element)
14
15 @if (is_string($element))
16 <li class="disabled"><span>{{ $element }}</span></li>
17 @endif
18
19
20
21 @if (is_array($element))
22 @foreach ($element as $page => $url)
23 @if ($page == $paginator->currentPage())
24 <li class="active my-active"><span>{{ $page }}</span></li>
25 @else
26 <li><a href="{{ $url }}">{{ $page }}</a></li>
27 @endif
28 @endforeach
29 @endif
30 @endforeach
31
32
33
34 @if ($paginator->hasMorePages())
35 <li><a href="{{ $paginator->nextPageUrl() }}" rel="next">Next →</a></li>
36 @else
37 <li class="disabled"><span>Next →</span></li>
38 @endif
39 </ul>
40@endif
1php artisan vendor:publish --tag=laravel-pagination
2 OR
3use Illuminate\Pagination\Paginator;
4
5public function boot()
6{
7 Paginator::defaultView('your-pagination-view-name');
8
9}