To do this, you need to initialize the counter value:
<?php $count = (($current_page_number - 1) * $items_per_page) + 1; ?>
Note I first subtract 1 from the current page, so the first page number is 0 . Then I add 1 to the overall result, so your first element starts with 1 , not 0 .
Laravel Paginator provides a convenient shortcut for this:
<?php $count = $players->getFrom() + 1; ?> @foreach ($players as $player) ...
There are several others you can use as you wish:
$players->getCurrentPage(); $players->getLastPage(); $players->getPerPage(); $players->getTotal(); $players->getFrom(); $players->getTo();
source share