Repeater acts differently when used inside createOptionForm

Hello everyone, so here's the situation - I have a ComparisonTableResource which basically lets the user build comparison tables on the frontent and includes a list of Operators (a different model) and lets the user change their order in such way -

Repeater::make('operators')
                    ->relationship('operators')
                    ->schema([
                        Select::make('operator_id')
                            ->label('Operator')
                            ->options(\App\Models\Operator::all()->pluck('name', 'id')),
                    ])
                    ->reorderable()
                    ->columnSpanFull(),


It works just fine and behaves as expected, including saving the correct order inside the pivot table between Operator and ComparisonTable (comparison_table_operator).
Now, I have a different model and a resource called Lander in which the user can choose an existing comparison table or create a new one, like this (in LanderResource.php) -

Select::make('comparison_tables_id')
->relationship('comparison_table', 'title')
->createOptionForm([
                      
                        Repeater::make('operators')
                            ->relationship('operators')
                            ->schema([
                                Select::make('operator_id')
                                    ->label('Operator')
                                    ->options(\App\Models\Operator::all()->pluck('name', 'id')),
                            ])
                            ->reorderable()
                            ->columnSpanFull(),
                    ]),
...


Now, when simply selecting an existing comparison table - it works just fine, but when creating a new one and selecting the operators in the modal form, i get an error. saying SQLSTATE[HY000]: General error: 1364 Field 'name' doesn't have a default value.
Was this page helpful?