Repeater reordering violates unique constraint

Hi, I try to reorder my items and SQL throws violates unique constraint. When i clone a item it works but not when i reorder.

Filament: 3.0.86

My code:

Forms\Components\Repeater::make('days')
                    ->relationship()
                    ->label('Days')
                    ->cloneable()
                    ->collapsible()
                    ->collapsed()
                    ->orderColumn('day')
                    ->reorderableWithButtons()
                    ->itemLabel(function (array $state) {
                        $labels = [];

                        if (isset($state['day']) && $state['day']) {
                            $labels[] = 'Day ' . $state['day'];
                        }

                        if (isset($state['nutrients']) && count($state['nutrients'])) {
                            $labels[] = "N" . count($state['nutrients']);
                        }

                        if (isset($state['oncePerDayNutrients']) && count($state['oncePerDayNutrients'])) {
                            $labels[] = "O" . count($state['oncePerDayNutrients']);
                        }

                        if (isset($state['lights']) && count($state['lights'])) {
                            $labels[] = "L" . count($state['lights']);
                        }

                        return count($labels) ? implode(' | ', $labels) : null;
                    })
Was this page helpful?