Skip to content

Commit

Permalink
Correct pagination when firstItem() is null (#39894)
Browse files Browse the repository at this point in the history
When `firstItem()` is null, the template returns “Showing to of 28 results” 

This PR does a quick check, and when needed will render “Showing 0 of 28 results” instead.
  • Loading branch information
xanderificnl committed Dec 6, 2021
1 parent 81d3587 commit e772d1d
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/Illuminate/Pagination/resources/views/tailwind.blade.php
Expand Up @@ -26,9 +26,13 @@
<div>
<p class="text-sm text-gray-700 leading-5">
{!! __('Showing') !!}
<span class="font-medium">{{ $paginator->firstItem() }}</span>
{!! __('to') !!}
<span class="font-medium">{{ $paginator->lastItem() }}</span>
@if ($paginator->firstItem())
<span class="font-medium">{{ $paginator->firstItem() }}</span>
{!! __('to') !!}
<span class="font-medium">{{ $paginator->lastItem() }}</span>
@else
{{ $paginator->count() }}
@endif
{!! __('of') !!}
<span class="font-medium">{{ $paginator->total() }}</span>
{!! __('results') !!}
Expand Down

0 comments on commit e772d1d

Please sign in to comment.