© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•2y ago•
1 reply
schwartzmj

Pre-populating form and saving to pivot

4 tables and one pivot table:
Products
Products
,
Product_Options
Product_Options
,
Product_Option_Values
Product_Option_Values
, and
Product_Variants
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
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
Size: SM, MD, LG
and
Color: Red, Blue
Color: Red, Blue


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:
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Pivot not saving to db?
FilamentFFilament / ❓┊help
3y ago
problem saving pivot table
FilamentFFilament / ❓┊help
3y ago
TableRepeater / Repeater populating form
FilamentFFilament / ❓┊help
13mo ago
Repeater not saving pivot relationship
FilamentFFilament / ❓┊help
2y ago