title: What's the difference between with() and compact() in Laravel
body: <p>What's the difference between the functions <code>with()</code> and <code>compact()</code> in Laravel in these two examples:</p>
  
  <p><strong>Example 1:</strong></p>
  
  <pre><code>return View::make('books.index')-&gt;with('booksList', $booksList);
  </code></pre>
  
  <p><strong>Example 2:</strong></p>
  
  <pre><code>return View::make('books.index',compact('booksList'));
  </code></pre>