-
-
Save tompec/cd4051aafebd3c150c72771902746821 to your computer and use it in GitHub Desktop.
@if ($paginator->hasPages()) | |
<nav class="pagination is-centered"> | |
@if ($paginator->onFirstPage()) | |
<a class="pagination-previous" disabled>Previous</a> | |
@else | |
<a href="{{ $paginator->previousPageUrl() }}" rel="prev" class="pagination-previous">Previous</a> | |
@endif | |
@if ($paginator->hasMorePages()) | |
<a class="pagination-next" href="{{ $paginator->nextPageUrl() }}" rel="next">Next</a> | |
@else | |
<a class="pagination-next" disabled>Next page</a> | |
@endif | |
<ul class="pagination-list"> | |
{{-- Pagination Elements --}} | |
@foreach ($elements as $element) | |
{{-- "Three Dots" Separator --}} | |
@if (is_string($element)) | |
<li><span class="pagination-ellipsis"><span>{{ $element }}</span></span></li> | |
@endif | |
{{-- Array Of Links --}} | |
@if (is_array($element)) | |
@foreach ($element as $page => $url) | |
@if ($page == $paginator->currentPage()) | |
<li><a class="pagination-link is-current">{{ $page }}</a></li> | |
@else | |
<li><a href="{{ $url }}" class="pagination-link">{{ $page }}</a></li> | |
@endif | |
@endforeach | |
@endif | |
@endforeach | |
</ul> | |
</nav> | |
@endif |
Thank you @tompec, just integrated and works fine with Laravel 5.6 and bulma 0.6.2
Thanks, this was useful.
Thanks. It was useful.
Thanks !
This is amazing @tompec, saved me a lot of work! Works with bulma 0.70
Thanks man
Thanks!
Really useful, thx allot!
In my case I needed a little more flexibility, and also needed some translation. Luckily the links()
method accepts a data array, so I have added the following code to <nav class=”pagination”>
element:
<nav class="pagination @isset($bulmaClasses) {{ $bulmaClasses }} @else is-centered @endisset">
And to the anchor tags:
@if ($paginator->onFirstPage())
<a class="pagination-previous" disabled>@if(!empty($previous)) {{ $previous }} @else Previous @endif</a>
@else
<a href="{{ $paginator->previousPageUrl() }}" rel="prev" class="pagination-previous">@isset($previous) {{ $previous }} @else Previous @endisset</a>
@endif
and:
@if ($paginator->hasMorePages())
<a class="pagination-next" href="{{ $paginator->nextPageUrl() }}" rel="next">@isset($next){{ $next }}@else Next @endisset</a>
@else
<a class="pagination-next" disabled>@isset($next){{ $next }}@else Next page @endisset</a>
@endif
So now I can include it like this:
$data->links('vendor.pagination.bulma', ['bulmaClasses' => 'is-small is-centered', 'next' => '/*text for next button*/', 'previous' => '/*text for previous button*/'])
@13ens yes, or you just save this gist in
resources/views/vendor/pagination/bulma.blade.php
.Then in your view you use
{{ $data->links('vendor.pagination.bulma') }}
.