Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Pagination template for Laravel 5 + Bulma
@if ($paginator->hasPages())
<nav class="pagination is-centered" role="navigation" aria-label="pagination">
{{-- Previous Page Link --}}
@if ($paginator->onFirstPage())
<a class="pagination-previous" disabled>«</a>
<a href="{{ $paginator->previousPageUrl() }}" class="pagination-previous">«</a>
{{-- Next Page Link --}}
@if ($paginator->hasMorePages())
<a href="{{ $paginator->nextPageUrl() }}" class="pagination-next">»</a>
<a class="pagination-next" disabled>»</a>
<ul class="pagination-list">
{{-- Pagination Elements --}}
@foreach ($elements as $element)
{{-- "Three Dots" Separator --}}
@if (is_string($element))
<li><span class="pagination-ellipsis">&hellip;</span></li>
{{-- Array Of Links --}}
@if (is_array($element))
@foreach ($element as $page => $url)
@if ($page == $paginator->currentPage())
<li class="active"><span></span></li>
<li><a class="pagination-link is-current" aria-label="Page {{ $page }}" aria-current="page">{{ $page }}</a></li>
<li><a href="{{ $url }}" class="pagination-link" aria-label="Goto page {{ $page }}">{{ $page }}</a></li>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment