SELECT * FROM users WHERE id IN (SELECT worker_id from projects up WHERE (SELECT COUNT(*) from projects below WHERE status = 2 and below.worker_id= up.worker_id) > 2 GROUP BY below.worker_id)
Below is the attempt which fails and the issues is how to use the count within the subquery as it up in the pure mysql query.
User::whereIn('id', function($query){
$query->select('worker_id')
->from('projects as up')
->where(function($query){
$query->selectRaw('COUNT(*) as count')
->from('projects as below')
->where('status', 2)
->having('count', '>', 2)
->having('below.worker_id', '=', 'up.worker_id')
->groupBy('below.worker_id')
}) ;
})->get();
But I gave the exact same reply on that other post. But rather than copying and pasting the examples I referred you to the query Builder chapter which has all of those examples. So I'm confused on why you said you didn't get no reply.
@TaylorOtwell included many great examples to learn from all through the documentation.