Skip to content

Instantly share code, notes, and snippets.

@KABBOUCHI
Forked from tompec/bulma.blade.php
Created September 8, 2017 18:16
Show Gist options
  • Save KABBOUCHI/c3dd175ba975290776f1dd3ca76714f7 to your computer and use it in GitHub Desktop.
Save KABBOUCHI/c3dd175ba975290776f1dd3ca76714f7 to your computer and use it in GitHub Desktop.
Bulma blade template for Laravel 5.4 pagination
@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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment