Created
May 28, 2017 13:41
-
-
Save rommelporras/739798d3ca917c6ed737d9fc49808bf8 to your computer and use it in GitHub Desktop.
Bulma pagination for Laravel - Laravel Bulma Pagination
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@if ($paginator->hasPages()) | |
<nav class="pagination is-centered"> | |
{{-- Previous Page Link --}} | |
@if ($paginator->onFirstPage()) | |
<a class="pagination-previous" disabled>Previous</a> | |
@else | |
<a href="{{ $paginator->previousPageUrl() }}" class="pagination-previous" rel="prev">Previous</a> | |
@endif | |
{{-- Pagination Elements --}} | |
<ul class="pagination-list"> | |
@foreach ($elements as $element) | |
{{-- "Three Dots" Separator --}} | |
@if (is_string($element)) | |
<li><span class="pagination-ellipsis">{{ $element }}</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> | |
{{-- Next Page Link --}} | |
@if ($paginator->hasMorePages()) | |
<a href="{{ $paginator->nextPageUrl() }}" rel="next" class="pagination-next">Next Page</a> | |
@else | |
<a class="pagination-next" disabled>Next Page</a> | |
@endif | |
</nav> | |
@endif |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment