title: Understanding Laravel: Please explain "->with('i', ($request->input('page', 1) - 1) * 5); "
body: <p>Please forgive me for asking a probably beginners-question. It's only that I really searched the net without finding answers! SOF seems like my last option before turning crazy.</p>
  
  <p>My problem is, that I simply can't understand what this line of code does:</p>
  
  <pre><code>-&gt;with('i', ($request-&gt;input('page', 1) - 1) * 5);
  </code></pre>
  
  <p>It lays in my Controller index(request $Request) method.</p>
  
  <p>The whole looks like this:</p>
  
  <pre><code>public function index(Request $request)
  {
      $books = Book::indexBooks()-&gt;paginate(20);
      return view('bookCRUD.index', compact('books'))
          -&gt;with('i', ($request-&gt;input('page', 1) - 1) * 5);
  }
  </code></pre>
  
  <p>Another User wrote this, but I cant make sense of it.</p>
  
  <blockquote>
    <p>That code will get the top 5 of all products, ordered by the id of products in descending order. Then the products data are passed into the view named index.blade.php inside ProductCRUD directory. You could find that directory on yourproject/resources/views. It also flashes a session variable named i (on the view you could access the variable using $i), which have the value of the form input / query string named page, if it exists. Otherwise, the $request->input('page', 1) = 1. From the usage of that variable, the $i will act as starting row number of each page on the grid.</p>
  </blockquote>
  
  <p>I would be the happiest to receive constructive answers!</p>