title: How to do this in laravel, Subquery where count
body: <p>I am trying to implement this query in Laravel</p>
  
  <pre><code>"SELECT * FROM jobs 
  WHERE status = 1 AND 
  taskerCount = (SELECT count(*) FROM jobRequests WHERE status = 1 AND job_id = 
  jobs.id)"
  </code></pre>
  
  <p>This is what i have tried;</p>
  
  <pre><code>Auth::user()-&gt;jobs
          -&gt;where('status', 1)
          -&gt;where('taskerCount', function ($q) {
              $q-&gt;where('status', 1)
                -&gt;where('job_id', $q-&gt;id)-&gt;count();
          });
  </code></pre>
  
  <p>But I get the error:</p>
  
  <blockquote>
    <p>Object of class Closure could not be converted to int.</p>
  </blockquote>