@if($products->count() > 0) @php $serial_no = (($products->currentpage()-1)*$products->perpage()+1); @endphp @foreach($products as $index => $p) {{ $p->id }} {{ $p->category->name }} {{ $p->quantity }}

${{ $p->price }}

@php $serial_no++; @endphp @endforeach Showing {{($products->currentpage()-1)*$products->perpage()+1}} to @php $productsCount = $products->currentpage()*$products->perpage(); @endphp @if($productsCount > $products->total()) {{$products->total()}} @else {{$products->currentpage()*$products->perpage()}} @endif of {{$products->total()}} entries @endif