Skip to content

Instantly share code, notes, and snippets.

@themsaid
Created April 21, 2017 12:57
Show Gist options
  • Save themsaid/163a080c02a42ea8e4cf80a272ff3329 to your computer and use it in GitHub Desktop.
Save themsaid/163a080c02a42ea8e4cf80a272ff3329 to your computer and use it in GitHub Desktop.
Pagination view for UIkit
@if ($paginator->hasPages())
<ul class="uk-pagination">
@if ($paginator->onFirstPage())
<li class="uk-disabled"><a href="#"><span uk-pagination-previous></span></a></li>
@else
<li><a href="{{ $paginator->previousPageUrl() }}"><span uk-pagination-previous></span></a></li>
@endif
{{-- Pagination Elements --}}
@foreach ($elements as $element)
{{-- "Three Dots" Separator --}}
@if (is_string($element))
<li class="uk-disabled"><span>...</span></li>
@endif
{{-- Array Of Links --}}
@if (is_array($element))
@foreach ($element as $page => $url)
@if ($page == $paginator->currentPage())
<li class="uk-active"><span>{{ $page }}</span></li>
@else
<li><a href="{{ $url }}">{{ $page }}</a></li>
@endif
@endforeach
@endif
@endforeach
{{-- Next Page Link --}}
@if ($paginator->hasMorePages())
<li><a href="{{ $paginator->nextPageUrl() }}"><span uk-pagination-next></span></a></li>
@else
<li class="uk-disabled"><a href="#"><span uk-pagination-next></span></a></li>
@endif
</ul>
@endif
@yelabbassidev
Copy link

Thanks for you <3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment