title: Laravel Eloquent Query - limit on a count()
body: <p>I need to know if a table has more than 50 rows fitting some criteria. So, the raw query should look like this:</p>
  
  <p><code>SELECT COUNT(id) FROM (SELECT id FROM table WHERE {conditions} LIMIT 50)</code></p>
  
  <p>but I'm having trouble doing this through eloquent. This is what I've tried so far....</p>
  
  <p><code>card::where( ... )-&gt;limit(50)-&gt;count("id");</code></p>
  
  <p>... but this doesn't work. It doesn't make the subquery for the limit, so the limit becomes useless.</p>
  
  <p>Without running a subquery that is limited, the query takes up to 10 times longer..... I'm afraid it won't be as scalable as I need.</p>