Skip to content

Instantly share code, notes, and snippets.

@JVMartin
Created August 29, 2016 02:32
Show Gist options
  • Save JVMartin/9dc999e2b6098d1bdfefd9e5dacf3497 to your computer and use it in GitHub Desktop.
Save JVMartin/9dc999e2b6098d1bdfefd9e5dacf3497 to your computer and use it in GitHub Desktop.
Laravel 5.3 Pagination View for Foundation for Sites 6
<ul class="pagination" aria-label="Pagination">
<!-- Previous Page Link -->
@if ($paginator->onFirstPage())
<li class="pagination-previous disabled"></li>
@else
<li class="pagination-previous">
<a href="{{ $paginator->previousPageUrl() }}" rel="prev"></a>
</li>
@endif
<!-- Pagination Elements -->
@foreach ($elements as $element)
<!-- "Three Dots" Separator -->
@if (is_string($element))
<li class="ellipsis"></li>
@endif
<!-- Array Of Links -->
@if (is_array($element))
@foreach ($element as $page => $url)
@if ($page == $paginator->currentPage())
<li class="current">{{ $page }}</li>
@else
<li><a href="{{ $url }}">{{ $page }}</a></li>
@endif
@endforeach
@endif
@endforeach
<!-- Next Page Link -->
@if ($paginator->hasMorePages())
<li class="pagination-next">
<a href="{{ $paginator->nextPageUrl() }}" rel="next"></a>
</li>
@else
<li class="pagination-next disabled"></li>
@endif
</ul>
@JVMartin
Copy link
Author

Simply put this file in resources/views/vendor/pagination/foundation-6.blade.php and then use it like this:

<div class="pagination text-center">
    {{ $models->links('pagination::foundation-6') }}
</div>

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