You can chain eager loading to avoid N+1 problem. Suppose you have 3 tables.
customer[id, email], pos[id, serial_number] and restaurant[id, name, customer_id, pos_id]
so restaurant table can act like a pivot table and it also have some value attribute.
So now we can call customer from pos table via chaining eager loading.