create and attach related models when creating resource

Hi there. First time trying/looking into filament to replace some of my own solution. I have a Team model with hasmany relation to Uniform model. I’m just wondering if it’s possible somehow from the Team create page to also create an amount of uniform models at the same time. Any pointers to relevant docs or anything appreciated. Looking forward to diving in to this.
4 Replies
Dennis Koch
Dennis Koch12mo ago
You could use a Repeater and store that data yourself. I think Repeater only supports BelongsToMany not HasMany, might be wrong though
wing5wong
wing5wong12mo ago
Thanks dennis. for this id like to create an amount of generic uniform items (this could be a field in the form). If im correct, i would need to start here - https://filamentphp.com/docs/3.x/panels/resources/creating-records#customizing-the-creation-process 1) Create the team 2) Create X number of uniforms and attach them to the team $team->saveMany($uniforms) 3) return the Team Does that sound right?
Solution
wing5wong
wing5wong12mo ago
Thanks. il start there. appreciate it