Laravel Bulma 分页

Laravel Bulma 分页

创建分页模版

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
// resources\views\vendor\pagination\bulma.blade.php
@if ($paginator->hasPages())
<nav class="pagination is-centered is-small">
<ul class="pagination-list">
@foreach ($elements as $element)
@if (is_string($element))
<li>
<span class="pagination-ellipsis">{{ $element }}</span>
</li>
@endif

@if (is_array($element))
@foreach ($element as $page => $url)
<li>
@if ($page == $paginator->currentPage())
<a class="pagination-link is-current" aria-current="page">{{ $page }}</a>
@else
<a class="pagination-link" href="{{ $url }}">{{ $page }}</a>
@endif
</li>
@endforeach
@endif
@endforeach
</ul>
</nav>
@endif

调用

1
2
3
4
$list->links('vendor.pagination.bulma')

// 如果还通过url参数可使用下面这个
$list->appends(request()->query())->links('vendor.pagination.bulma')
往上