Skip to content

Instantly share code, notes, and snippets.

@poloey
Created February 20, 2018 20:17
Show Gist options
  • Save poloey/2fd62fbf5df91f02b96c25def5d569e6 to your computer and use it in GitHub Desktop.
Save poloey/2fd62fbf5df91f02b96c25def5d569e6 to your computer and use it in GitHub Desktop.
laravel materialize pagination
@if ($paginator->hasPages())
<ul class="pagination">
{{-- Previous Page Link --}}
@if ($paginator->onFirstPage())
<li class="disabled"><i class="material-icons">chevron_left</i></li>
@else
<li class="waves-effect"><a href="{{ $paginator->previousPageUrl() }}"><i class="material-icons">chevron_left</i></a></li>
@endif
{{-- Pagination Elements --}}
@foreach ($elements as $element)
{{-- "Three Dots" Separator --}}
@if (is_string($element))
<li class="disabled">{{ $element }}</li>
@endif
{{-- Array Of Links --}}
@if (is_array($element))
@foreach ($element as $page => $url)
@if ($page == $paginator->currentPage())
<li class="active">
<a>{{ $page }}</a>
</li>
@else
<li class="waves-effect"><a class="page-link" href="{{ $url }}">{{ $page }}</a></li>
@endif
@endforeach
@endif
@endforeach
{{-- Next Page Link --}}
@if ($paginator->hasMorePages())
<li class="waves-effect"><a href="{{ $paginator->nextPageUrl() }}"><i class="material-icons">chevron_right</i></a></li>
@else
<li class="disabled"><a href="{{ $paginator->nextPageUrl() }}"><i class="material-icons">chevron_right</i></a></li>
@endif
</ul>
@endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment