ANSWERS: 1
-
Not really. I've seen people do this with Eloquent: User::leftJoin( DB::raw('(SELECT item_id, SUM(1) AS likes FROM likes GROUP BY item_id) as i'), 'i.item_id', '=', 'items.id' )->get(); But, of course, that breaks DB compatibility in sqlite if you do unit tests.
Copyright 2023, Wired Ivy, LLC