11 months ago

Many to Many in Many to Many

Posted 11 months ago by elliotk


I have a Product model, which belongs to many Categories. I also have a Discount model which belongs to many Categories.

I want to loop through a set of Products (in a basket) and calculate a discount against those where the given Discount Category is the same as the Product Category.

I don't think it's this I need https://laravel.com/docs/5.7/eloquent-relationships#has-many-through but rather some kind of IN method.


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