Created
July 28, 2022 07:04
-
-
Save HORKimhab/096b43ab7983785703c91d016fd1c04b to your computer and use it in GitHub Desktop.
customize pagination bootstrap5.1.3
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 aria-label="..."> | |
<ul class="pagination"> | |
@if ($paginator->onFirstPage()) | |
{{-- <li class="page-link disabled"><span>← Previous</span></li> --}} | |
<li class="page-item disabled"> | |
<a class="page-link">← Previous</a> | |
</li> | |
@else | |
<li class="page-item"><a class="page-link" href="{{ $paginator->previousPageUrl() }}" rel="prev">← Previous</a></li> | |
@endif | |
@foreach ($elements as $element) | |
@if (is_string($element)) | |
{{-- <li class="page-link disabled"><span>{{ $element }}</span></li> --}} | |
<li class="page-item disabled"> | |
<a class="page-link">{{ $element }}</a> | |
</li> | |
@endif | |
@if (is_array($element)) | |
@foreach ($element as $page => $url) | |
@if ($page == $paginator->currentPage()) | |
<li class="page-item active"><a class="page-link">{{ $page }}</a></li> | |
@else | |
<li class="page-item"><a class="page-link" href="{{ $url }}">{{ $page }}</a></li> | |
@endif | |
@endforeach | |
@endif | |
@endforeach | |
@if ($paginator->hasMorePages()) | |
<li class="page-item"><a class="page-link" href="{{ $paginator->nextPageUrl() }}" rel="next">Next →</a></li> | |
@else | |
<li class="page-item disabled"> | |
<a class="page-link">Next →</a> | |
</li> | |
@endif | |
</ul> | |
</nav> | |
<style> | |
.page-item.disabled .page-link{ | |
cursor:not-allowed !important; | |
pointer-events: initial; | |
} | |
</style> | |
@endif |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment