首页 > 解决方案 > Complex combinatoric database tree - many to many with variation pivot

问题描述

I'll keep it short and brief. I've got two models: Scheme and Feature with a many to many relationship between them. What I want to achieve but don't know how is the following: I need a given value to be present in a database according to the features a scheme has. That means, for every possible combination of a scheme and all of the possible features, I want to have a particular value (in this case - an image to display for the scheme according to its features). Example:

Scheme 1 has feature 1 - image 1;

Scheme 1 has feature 2 - image 2;

Scheme 1 has feature 1 and 2 - image 3

Scheme 1 has feature 1 and 3 - image 4 and so on.

What is the optimal db structure for that purpose? Thanks in advance!

标签: databaselaravelrelationship

解决方案


看看这两个命题,然后选择。

在此处输入图像描述


推荐阅读