Skip to content

Instantly share code, notes, and snippets.

@UnderlineWords
Last active September 28, 2019 22:56
Show Gist options
  • Save UnderlineWords/3b75e5b96ab5a8cb9c6dd9831b5a8bee to your computer and use it in GitHub Desktop.
Save UnderlineWords/3b75e5b96ab5a8cb9c6dd9831b5a8bee to your computer and use it in GitHub Desktop.
Custom Laravel Pagination for Bulma - Laravel Documentation https://laravel.com/docs/master/pagination
<?php
/**
* Bulma CSS Framework
* Includes previous and next buttons
* @example $pages->links('pagination', ['paginator' => $pages])
* @example @include('pagination', ['paginator' => $pages])
*
* @link https://bulma.io/documentation/components/pagination/
**/
?>
<nav class="pagination is-centered" role="navigation" aria-label="pagination">
<a href="{{ $paginator->previousPageUrl() }}" class="pagination-previous" @if($paginator->currentPage() == 1) disabled @endif>
Previous
</a>
<a href="{{ $paginator->nextPageUrl() }}" class="pagination-next" @if($paginator->currentPage() == $paginator->lastPage()) disabled @endif>
Next
</a>
<ul class="pagination-list">
@for ($i = 1; $i <= $paginator->lastPage(); $i++)
<li>
<a href="{{ $paginator->url($i) }}" class="pagination-link @if($paginator->currentPage() == $i) is-current @endif">
{{ $i }}
</a>
</li>
@endfor
</ul>
</nav>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment