Created
December 6, 2018 18:20
-
-
Save deeshrestha/362490aead2fc4b2fd15c3aae24254cf to your computer and use it in GitHub Desktop.
Bulma Blade Template For Laravel 5.7 Pagination
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{{-- | |
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> | |
@else | |
<a class="pagination-previous" href="{{ $paginator->previousPageUrl() }}">Previous</a> | |
@endif | |
{{-- Next Page Link --}} | |
@if ($paginator->hasMorePages()) | |
<a class="pagination-next" href="{{ $paginator->nextPageUrl() }}">Next Page</a> | |
@else | |
<a class="pagination-next" disabled>Next Page</a> | |
@endif | |
{{-- Pagination Elements --}} | |
<ul class="pagination-list"> | |
@foreach ($elements as $element) | |
{{-- "Three Dots" Separator --}} | |
@if (is_string($element)) | |
<li><span class="pagination-ellipsis">…</span></li> | |
@endif | |
{{-- 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> | |
@else | |
<li><a href="{{ $url }}" class="pagination-link" aria-label="Goto page {{ $page }}">{{ $page }}</a></li> | |
@endif | |
@endforeach | |
@endif | |
@endforeach | |
</ul> | |
</nav> | |
@endif |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks!
Still works on Laravel 8, but now the file to replace the code is
tailwind.blade.php