FilamentF
Filament2y ago
Rome

RelationManager problem with duplicate relationship

I have a N-M relation with RelationManager: companies and items and pivot table company_item. Pivot table has a boolean obsolete field.

The problem is that I have a ToggleColumn on this obsolete field but when a company has two same items (same item_id but different pivot_id, the toggle will work on first ocurrence because is taking item_id and should take pivot_id for this.

Instead of taking pivot_id (2809 and 5895) is taking the item_id.
Solution
Ok, I solved with allowDuplicates():
return $table ->allowDuplicates();
Was this page helpful?