Repeater pivot
Hi, I'm having a problem with the repeater.
My problem: I've created a pivot table but I don't understand why it doesn't go into the pivot table but into the artist table, so it creates a new artist for me every time I add it, when my aim is for it to register only in my pivot table.
Solution:Jump to solution
Did you create a
hasMany
relationship with the pivot class? Also, there are certain limitations with repeaters - you need a unique ID on the pivot table for them to work property.
Please ensure that your pivot model has a primary key column, like id, to allow Filament to keep track of which repeater items have been created, updated and deleted.https://filamentphp.com/docs/3.x/forms/fields/repeater#integrating-with-a-belongstomany-eloquent-relationship...
4 Replies
didnt test your code, but colud it be coz you have the same name
artists
in the Repeater and the select?I changed the name and the problem persists.
Solution
Did you create a
hasMany
relationship with the pivot class? Also, there are certain limitations with repeaters - you need a unique ID on the pivot table for them to work property.
Please ensure that your pivot model has a primary key column, like id, to allow Filament to keep track of which repeater items have been created, updated and deleted.https://filamentphp.com/docs/3.x/forms/fields/repeater#integrating-with-a-belongstomany-eloquent-relationship
Thank you, you saved my life, I lost 4 hours, I could have lost much more. bisous π