custom pagination ui in laravel 8 code example
Example 1: laravel pagination
{{ $users->withQueryString()->links() }}
Example 2: custom laravel pagination
@if ($paginator->hasPages())
@if ($paginator->onFirstPage())
- ← Previous
@else
- ← Previous
@endif
@foreach ($elements as $element)
@if (is_string($element))
- {{ $element }}
@endif
@if (is_array($element))
@foreach ($element as $page => $url)
@if ($page == $paginator->currentPage())
- {{ $page }}
@else
- {{ $page }}
@endif
@endforeach
@endif
@endforeach
@if ($paginator->hasMorePages())
- Next →
@else
- Next →
@endif
@endif