I have an eloquent model
Booking which has many
When I output a a session, or list of sessions, I often need the total number of sessions in that same booking. What's the best way to go about this?
$session->booking->sessions()->count() would create 2 extra queries per Session object.
I know that eager-loading would reduce queries, but I just want to know if I'm fundamentally missing a trick. I've also considered storing the session count in the booking table, but thought maybe it was bad practice.