Skip to content

Instantly share code, notes, and snippets.

@tokoiwesley
Last active February 14, 2018 08:43
Show Gist options
  • Save tokoiwesley/11cb23cdc1eca972ad05afae62f22ce5 to your computer and use it in GitHub Desktop.
Save tokoiwesley/11cb23cdc1eca972ad05afae62f22ce5 to your computer and use it in GitHub Desktop.
Semantic UI Pagination in Laravel
<?php
/**
* Semantic UI
* Includes previous and next buttons
* @example $pages->links('vendor.pagination.semantic-ui', ['paginator' => $pages])
* @example @include('vendor.pagination.semantic-ui', ['paginator' => $pages])
*
* @link https://semantic-ui.com/collections/menu.html#inverted Inverted styles
* @see <div class="ui pagination inverted blue menu"> Inverted blue menu
**/
?>
@if ($paginator->lastPage() > 1)
<div class="ui pagination menu">
<a href="{{ $paginator->previousPageUrl() }}" class="{{ ($paginator->currentPage() == 1) ? ' disabled' : '' }} item">
Previous
</a>
@for ($i = 1; $i <= $paginator->lastPage(); $i++)
<a href="{{ $paginator->url($i) }}" class="{{ ($paginator->currentPage() == $i) ? ' active' : '' }} item">
{{ $i }}
</a>
@endfor
<a href="{{ $paginator->nextPageUrl() }}" class="{{ ($paginator->currentPage() == $paginator->lastPage()) ? ' disabled' : '' }} item">
Next
</a>
</div>
@endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment