Tuesday, April 4, 2017

Laravel - HasMany Relationship search

I've code like this

Product Table
--id

Attributes
--id
--product_id
--type

AttributeMap
-id
--attribute_id

--product_id

For example, Each product can have multiple attributes - like have 20 different sizes ,etc.

Now I want to search it using multiple parameters. For example size=23, color=56, etc so that I can have a result that matches the parameters.

How is it possible using nested queries?



via kirobo

Advertisement