Created
August 28, 2017 02:34
-
-
Save MarcoNicolodi/65510ece8debf4c949582dac1cd22b74 to your computer and use it in GitHub Desktop.
Laravel 5 Foundation 6 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()) | |
<ul class="pagination" role="navigation" aria-label="Pagination"> | |
{{-- Previous Page Link --}} | |
@if ($paginator->onFirstPage()) | |
<li class="pagination-previous disabled">Previous <span class="show-for-sr">page</span></li> | |
@else | |
<li class="pagination-previous"><a href="{{ $paginator->previousPageUrl() }}">Previous <span class="show-for-sr">page</span></a></li> | |
@endif | |
{{-- Pagination Elements --}} | |
@foreach ($elements as $element) | |
{{-- "Three Dots" Separator --}} | |
@if (is_string($element)) | |
<li class="disabled"><span>{{ $element }}</span></li> | |
@endif | |
{{-- Array Of Links --}} | |
@if (is_array($element)) | |
@foreach ($element as $page => $url) | |
@if ($page == $paginator->currentPage()) | |
<li class="current"><span class="show-for-sr">You are on page</span> {{ $page }}</li> | |
@else | |
<li><a href="{{ $url }}" aria-label="Page {{$page}}">{{$page}}</a></li> | |
@endif | |
@endforeach | |
@endif | |
@endforeach | |
{{-- Next Page Link --}} | |
@if ($paginator->hasMorePages()) | |
<li class="pagination-next"><a href="{{ $paginator->nextPageUrl() }}" aria-label="Next page">Next <span class="show-for-sr">page</span></a></li> | |
@else | |
<li class="pagination-next disabled">Next <span class="show-for-sr">page</span></li> | |
@endif | |
</ul> | |
@endif() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment