title: How can I output the current iteration with Laravel's Paginate()?
body: <p>Laravel 5.2 application.</p>
  
  <p>I have a function in my controller that queries my DB with an order by clause to which I then paginate.</p>
  
  <pre><code>public function foo() {
  
    $results = DB::orderBy('name', 'desc')-&gt;paginate(15);
    return view('index', ['results' =&gt; $results]);
  
  }
  </code></pre>
  
  <p>index.blade.php</p>
  
  <pre><code>@foreach ($results as $result)
   &lt;tr&gt;
    &lt;td&gt;{{ //current $result position is what I need }}&lt;/td&gt;
    &lt;td&gt;{{ $result-&gt;name }}&lt;td&gt;
    //etc...
   &lt;/tr&gt;
  @endforeach
  </code></pre>
  
  <p>How could I output the current row order iteration?</p>
  
  <p>e.g.</p>
  
  <pre><code>Rank | name | //page 1
  1      bob  
  2      john
  3      katie
  Rank | name | //page 2
  4      dave  
  5      michael
  6      ruben
  </code></pre>
  
  <p>Usually I would just output the <code>id</code> but since I have an orderBy clause, the ID won't correctly reflect the current rank. And if I do something like a <code>for()</code> loop then when I go to the next page, it will reset the first result on the second page, to rank 1, even though it's the next page.</p>
  
  <p>Does Laravel have a specific way of achieving this? I've looked through the docs and I'm unable to find what I'm looking for.</p>