Umut PAMUK
Umut PAMUK

Reputation: 13

How to show the total number with Laravel Simple pagination?

I made simple paging with the collection macro to paginate the data in the series. How can I use simple paging result-> total () is not used? I want to do it briefly like gmaila. It has 1-50 / 200 <> style.

<div class="btn-group">
   <a href="{{ $dataArray->previousPageUrl() }}">
     <button type="button" class="btn btn-default btn-sm">
           <i class="fas fa-chevron-left"></i>
     </button>
    </a>
    <a href="{{ $dataArray->nextPageUrl() }}">
       <button type="button" class="btn btn-default btn-sm">
            <i class="fas fa-chevron-right"></i>
        </button>
    </a>
</div>

Upvotes: 0

Views: 150

Answers (1)

robotu
robotu

Reputation: 213

To have a pagination text similar to that of Gmail you can do this:

{{($items->currentPage() - 1) * $items->perPage() + 1 . '-' . $items->currentPage() * $items->perPage() . ' of ' . $items->total()}}

You can enter the code where you prefer in your view.

Upvotes: 1

Related Questions