Handling duplicates ManyToMany relationship | Documentation update #9450
KonstantinosVazaios
started this conversation in
General
Replies: 1 comment 1 reply
-
I followed the docs and it didnt allow me to add duplicates, Thanks to you, I was able to fix it |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I was reading the Filament Documentation about Relation Managers and specifically the sections about attaching & detaching records for a ManyToMany relationship. I needed to somehow allow the duplicate record attaches. I followed the documentation's steps in order to have that working.
However when I was to attach a record for the second time, the select input would not load the record again. I did a little research in the Filament classes and I noticed that inside the hasRecords trait there is a allowDuplicates() method.
I added this method at the returned $table object inside the table() method of the RelationManager class and I got it working.
In a nutshell, the $allowsDuplicates property to the relation manager does not solve the problem. We need to add allowDuplicates() method in the $table object.
We may need to update the Documentation
Beta Was this translation helpful? Give feedback.
All reactions