Pre-populating form and saving to pivot
4 tables and one pivot table:
The user creates a product, then creates its "Product Options" with available "Values". For example,
This works fine. The issue I'm encountering is when the user goes to create a new Product Variant (via a relation manage on the Product), I want to loop through all available Product Options and have them select a Value.
I've tried a number of things but none of it seems to be working correctly. This is the gist of one route I went:
Products, Product_Options, Product_Option_Values, and Product_Variants. The pivot table essentially just joins the 3 latter tables with unique constraints. I've made a custom pivot model for this and the relationship for the variant is selectedOptions which you'll see below.The user creates a product, then creates its "Product Options" with available "Values". For example,
Size: SM, MD, LG and Color: Red, BlueThis works fine. The issue I'm encountering is when the user goes to create a new Product Variant (via a relation manage on the Product), I want to loop through all available Product Options and have them select a Value.
I've tried a number of things but none of it seems to be working correctly. This is the gist of one route I went: