© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•2y ago•
15 replies
prowler

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(),
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
Operator
and
ComparisonTable
ComparisonTable
(
comparison_table_operator
comparison_table_operator
).
Now, I have a different model and a resource called
Lander
Lander
in which the user can choose an existing comparison table or create a new one, like this (in
LanderResource.php
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(),
                    ]),
...
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
SQLSTATE[HY000]: General error: 1364 Field 'name' doesn't have a default value
.
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307Members
Resources
Was this page helpful?

Similar Threads

Recent Announcements

Similar Threads

SpatieMediaLibraryFileUpload inside createOptionForm()
FilamentFFilament / ❓┊help
3y ago
Repeater Inside Repeater
FilamentFFilament / ❓┊help
7mo ago
How to implements repeater inside repeater
FilamentFFilament / ❓┊help
3y ago