Laravel 4 query builder - with complicated left joins
问题 I'm new to Laravel 4. I have this query: SELECT a.id, active, name, email, img_location, IFNULL(b.Total, 0) AS LeadTotal, IFNULL(c.Total, 0) AS InventoryTotal FROM users AS a LEFT JOIN ( SELECT user_id, count(*) as Total FROM lead_user GROUP BY user_id ) AS b ON a.id = b.user_id LEFT JOIN ( SELECT user_id, count(*) as Total FROM user_inventory GROUP BY user_id ) AS c ON a.id = c.user_id WHERE a.is_deleted = 0 How can I convert it to Laravel query builder? I'm confused on how to use the