I need to know if a table has more than 50 rows fitting some criteria. So, the raw query should look like this:
SELECT COUNT(id) FROM (SELECT id FROM table WHERE {conditions} LIMIT 50)
but I'm having trouble doing this through eloquent. This is what I've tried so far....
card::where( ... )->limit(50)->count("id");
... but this doesn't work. It doesn't make the subquery for the limit, so the limit becomes useless.
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.