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

princeoo7's avatar

Product Attributes and Attrubutes Value Table Complications

I have 4 tables in my database.

  1. Product
  2. Product Attributes
  3. Product Attributes Value
  4. Product Combinations

I have a question where table 2 and 3 are related.

for example I have 3 colors and 4 size for an product that makes a combination of 12 variety.

should I have 12 records in product attribute value table i.e. 3 record of color and 4 record of size or 1 record for each color and size respectively where all the variety are store as JSON or separated via comma ",".

There might also be a situation where we have 3 colors but each color don't have 4 size some color can only have 1 or 2 size also. How should I handle this via Eloquent Methods.

0 likes
0 replies

Please or to participate in this conversation.