Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

fenix1996l's avatar

Implementing filters for a product through relationships

Hello. The problem is in the implementation of filters for goods. There are such tables (you can correct me)

http://savepic.ru/13492212.jpg

In the filter table there can be color fields with id = 1, size with id = 2, and so on. In the attribute table, the attribute itself is obtained, for example Red means filter_id = 1, and so on. In the attribute_good table, the attributes for each product The question itself. How do I group attributes into a filter?

So I think it's like this:

http://jsoneditoronline.org/?id=248ea312f76ed4f4bbf374794213b0e5

But now I understand this, but there is a mistake. Displays the attributes of the goods and in them already as in relation displays the table with the filter. Those. I have 3 colors and 2 sizes means that there will be three times the color of the filter and 2 times the size of the filter. Those. At me now here so

http://jsoneditoronline.org/?id=46062b2ec2c37af51a408360351e095c

Do you think that it is possible to realize this through a relationship in Lara? Or is it better to write through a builder?

Sorry for my English

0 likes
0 replies

Please or to participate in this conversation.