Last active
December 7, 2020 21:49
-
-
Save canis/2dc8888177ff2796200c02b92e0ebf4f to your computer and use it in GitHub Desktop.
Laravel pagintion - bulma template
This file contains hidden or 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" role="navigation" aria-label="pagination"> | |
{{-- Previous Page Link --}} | |
@if ($paginator->onFirstPage()) | |
<button class="pagination-previous" disabled>@lang('pagination.previous')</button> | |
@else | |
<a class="pagination-previous" href="{{ $paginator->previousPageUrl() }}" | |
rel="prev" aria-label="@lang('pagination.previous')">@lang('pagination.previous')</a> | |
@endif | |
{{-- Next Page Link --}} | |
@if ($paginator->hasMorePages()) | |
<a class="pagination-next" href="{{ $paginator->nextPageUrl() }}" | |
rel="next" aria-label="@lang('pagination.next')">@lang('pagination.next')</a> | |
@else | |
<button class="pagination-next" disabled>@lang('pagination.next')</button> | |
@endif | |
<ul class="pagination-list"> | |
{{-- Pagination Elements --}} | |
@foreach ($elements as $element) | |
{{-- "Three Dots" Separator --}} | |
@if (is_string($element)) | |
<li><span class="pagination-ellipsis" aria-disabled="true">…</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" | |
aria-label="Page {{ $page }}" aria-current="page">{{ $page }}</a> | |
</li> | |
@else | |
<a class="pagination-link" aria-label="Goto page {{ $page }}" | |
href="{{ $url }}">{{ $page }}</a> | |
@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