paginate.blade.php
1.72 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
@if ($paginator->hasPages())
<div class="pagination">
@if ($paginator->onFirstPage())
@else
<a href="{{ $paginator->previousPageUrl() }}" class="pagination__nav pagination__nav_prev">
<svg>
<use xlink:href="{{ asset('images/sprite.svg#arrow-bold') }}"></use>
</svg>
</a>
@endif
@foreach ($elements as $element)
@if (is_string($element))
<span>{{ $element }}</span>
@endif
@if (is_array($element))
@php $count_element = count($element);
$i = 0;
@endphp
@foreach ($element as $page => $url)
@if ($page == $paginator->currentPage())
<span class="pagination__item active">{{ $page }}</span>
@else
@if (($i == $count_element - 1) && ($count_element > 5))
<span class="pagination__dots">
<svg>
<use xlink:href="{{ asset('images/sprite.svg#dots') }}"></use>
</svg>
</span>
@endif
<a href="{{ $url }}" class="pagination__item">{{ $page }}</a>
@endif
@php $i++; @endphp
@endforeach
@endif
@endforeach
@if ($paginator->hasMorePages())
<a href="{{ $paginator->nextPageUrl() }}" class="pagination__nav pagination__nav_next">
<svg>
<use xlink:href="{{ asset('images/sprite.svg#arrow-bold') }}"></use>
</svg>
</a>
@else
@endif
</div>
@endif