S
S
semki0962019-04-23 08:06:46
Laravel
semki096, 2019-04-23 08:06:46

How to group a group of products into one view, in my example?

For example, there is a phone model Nokia99. But in 3 colors. That is, in fact, these are 3 different products. The question is how to present these 3 products to the user as one product with a choice of colors. I would be grateful for advice.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
J
jazzus, 2019-04-23
@jazzus

If you are only interested in color, you create tables products, colors and intermediate product_colors . You write a relationship to Color
in the Product ManyToMany
model. As a result, you have a relationship between products and colors and you can make queries on these relationships , depending on the task.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question