© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•3y ago•
1 reply
Kitty

Repeater Relationship missing :condition

What I am trying to do: Not Create Empty Repeater Relationships
What I Tried: Using the :condition variable. HasOne components have a :condition variable on the ->relationship method that allows you to set the field as optional so that the form does not try to create the relationship with an empty value. But it seems the HasMany Repeater does not support this variable. What I would like help with: Q: Is this to be expected?
Q2: How can I make a repeater be optional?
Note: I would prefer to set default to 1 and not create empty relationships.

Example: Works
Forms\Components\Group::make()
                                ->relationship(
                                    'childFamilyIncome',
                                    condition: fn (?array $state): bool => filled($state['family_income_id']),
                                )
                                ->schema([
                                 ...
                                 ])
Forms\Components\Group::make()
                                ->relationship(
                                    'childFamilyIncome',
                                    condition: fn (?array $state): bool => filled($state['family_income_id']),
                                )
                                ->schema([
                                 ...
                                 ])


Example: Doesn't work. Error Unknown named parameter $condition

Forms\Components\Repeater::make('childEthnicities')
                                ->relationship('childEthnicities',
                                    condition: fn (?array $state): bool => filled($state['ethnicity_id']))
                                ->label('Child Ethnicities')
                                ->simple(
                                  ...
                                )
                                ->defaultItems(1)
Forms\Components\Repeater::make('childEthnicities')
                                ->relationship('childEthnicities',
                                    condition: fn (?array $state): bool => filled($state['ethnicity_id']))
                                ->label('Child Ethnicities')
                                ->simple(
                                  ...
                                )
                                ->defaultItems(1)
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

Repeater autosave relationship
FilamentFFilament / ❓┊help
2mo ago
Repeater relationship select
FilamentFFilament / ❓┊help
13mo ago