0

I am tasked to create a dashboard for an e-commerce business, in general, using Laravel Filament. While designing the database I made sure to include the feature of adding variants. As a result, I came up with 4 tables:

  • product_options (Color, Size)
  • product_option_values (Blue,Large)
  • product_variants
  • product_option_value_variant (To support the many to many relationship between product_option_values and product_variants)

enter image description here

While creating the form I used the CheckBoxList (A filament component that returns an array of the option_value_id) to add the variants. And there I noticed that I am adding Color Blue Color Red and Size Large to one variant which made me realize that the relationship between options_values and variants is not a many to many relationship.

Here's a picture of the CheckBoxList that I used:

enter image description here

So, a variant can have many options but only one value to this option. What relationship is that?


1 Answers1

0
$this->hasMany(Relation::class)->distinct();