Model relation with multiple keys

Posted 8 months ago by merisor

Hey guys,

This is probably trivial but i couldn't find an answer.

Let's say I have three Models

Order (order_id) OrderItems (order_id, item_id) OrderPromotion(order_id,item_id, other_fields)

Is there any way to make a relation from OrderItems to OrderPromotion

to be equivalent of select * from OrderPromotion where order_id = 11232 and item_id = 23432


Please sign in or create an account to participate in this conversation.

Laracasts Mascot

Hi, Have We Met Yet?

Did you know that, in addition to the forum, Laracasts includes well over 1000 lessons on modern web development? All for the price of one lunch out per month.

Sign Me Up


Reply to

Use Markdown with GitHub-flavored code blocks.