title: access to the count() function in laravel
body: <p>I've been following a tutorial which has shown me that i can pass the details of all records in a database table to a view like this:</p>
  
  <pre><code>$teams = $this-&gt;team-&gt;all();
  </code></pre>
  
  <p>In the view there is a section of code that says...</p>
  
  <pre><code>@if ($teams-&gt;count())
  </code></pre>
  
  <p>and this is fine... if there are $teams then do the next bit.</p>
  
  <p>The problem comes when I want to refine my query to this (i am passing $id into the controller):</p>
  
  <pre><code>$teams = DB::table('teams')-&gt;where('league_id', $id)-&gt;get();
  </code></pre>
  
  <p>Simply, when done this way, the count() function in the view is no longer available. 
  I have done print_r($teams) on both the resulting $teams arrays and the first one has so much more information available in it, but I was wondering if anyone can help me understand why count() ins't available and how i can 'reinstate it'?</p>
  
  <p>Many thanks.
  DS</p>