title: Laravel / Eloquent eager loading
body: <p>This will be an easy question for some, but I can't seem to find the answer online or in the documentation (only variants of it which I don't want).</p>
  
  <ul>
  <li>Lets say we have a <code>Question</code> class</li>
  <li>Each <code>Question</code> object can optionally have multiple <code>Tag</code>s</li>
  </ul>
  
  <p>I have set the classes up and things behave as expected. Currently I use:</p>
  
  <ul>
  <li><code>$questions = Question::all();</code></li>
  </ul>
  
  <p>This works as expected, however it does not eager load.</p>
  
  <p>To be clear: <code>$question-&gt;tags</code> gives the array I am expecting. There is not a relationship problem.</p>
  
  <p>Due to new requirements I will be creating a view with possibly thousands of questions, so this eager loading is a must.</p>
  
  <p>I attempted to use:</p>
  
  <ul>
  <li><code>$questions = Question::with('tag')-&gt;all();</code></li>
  </ul>
  
  <p>Which gives error message:</p>
  
  <blockquote>
    <p>BadMethodCallException in Builder.php line 2345: Call to undefined method Illuminate\Database\Query\Builder::all()</p>
  </blockquote>
  
  <p>Every tutorial, or way I google eager loading, either specifies an ID, OR is a tutorial on how to ONLY show parents with children. </p>
  
  <p>I simple want "all and their children".</p>
  
  <p>This has got to be easy.. does anyone know how to do it?</p>
  
  <p>Thanks
  Rick</p>