Question from Laracasts forum, let's try to solve it.
Look at the "Code snippet" section - user can have many bookings and each booking has many different items.
I want to get a user's sum of "item_num" column for a particular user but only of "confirmed" bookings.
Please write that Eloquent query. Something like:
$sum = BookingItem:: [... where user ID is 1 ...] AND [ ... where booking status is confirmed ... ] -> [GET SUM OF 'item_num'];