Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Bulma Blade Template For Laravel 5.7 Pagination
Laravel's default pagination html tags modifed to make Bulma CSS compatible paginator.
1. First run "php artisan vendor:publish --tag=laravel-pagination"
2. This command will place the views in the resources/views/vendor/pagination directory.
3. Replace text on "bootstrap-4.blade.php" with this code.
4. Remove other blade files if not needed (optional).
@if ($paginator->hasPages())
<nav class="pagination is-centered" role="navigation" aria-label="pagination">
{{-- Previous Page Link --}}
@if ($paginator->onFirstPage())
<a class="pagination-previous" disabled>Previous</a>
<a class="pagination-previous" href="{{ $paginator->previousPageUrl() }}">Previous</a>
{{-- Next Page Link --}}
@if ($paginator->hasMorePages())
<a class="pagination-next" href="{{ $paginator->nextPageUrl() }}">Next Page</a>
<a class="pagination-next" disabled>Next Page</a>
{{-- Pagination Elements --}}
<ul class="pagination-list">
@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><a class="pagination-link is-current" aria-label="Goto page {{ $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
You can’t perform that action at this time.