Plague
Plague
FFilament
Created by Plague on 1/24/2024 in #❓┊help
Repeater with ->distinct() Checkbox, how to not require one be selected.
The Repeater works great, I have an 'is_default' column for each item, I am using ->distinct() to make sure only 1 can be set to default. However I also want to support not selecting a default option. My issue is that if I try to save without checking one of the Repeater items as default it won't let me and shows a validation error "At least one is Default field must be selected." Here is my current the "Is Default" field in my Repeater.
Forms\Components\Checkbox::make('is_default')
->label('Is Default')
->default(false)
->distinct()
->fixIndistinctState()
->inline(false)
->columnSpan(1),
Forms\Components\Checkbox::make('is_default')
->label('Is Default')
->default(false)
->distinct()
->fixIndistinctState()
->inline(false)
->columnSpan(1),
I have tried adding ->nullable(), ->required(false), ->optional() I wan't the default checkbox to be optional, is there a way to make ->distinct() not require that one be selected?
4 replies