requiredIf() validation isn't working for File Upload component

I'm having a problem where the requiredIf validation doesn't work when I use it on a File Upload component. See code below. Is there a way around this?
Forms\Components\FileUpload::make('delivery_scan')
->requiredIf('delivery_type', 'Boat')
->columnSpan([
'md' => 2,
]),
Forms\Components\FileUpload::make('delivery_scan')
->requiredIf('delivery_type', 'Boat')
->columnSpan([
'md' => 2,
]),
3 Replies
bahamagician
bahamagicianOP2y ago
Ended up having to use $get() to customize it as below:
Forms\Components\FileUpload::make('delivery_scan')
->required(fn (Get $get) => $get('delivered') === true )
->columnSpan([
'md' => 2,
]),
Forms\Components\FileUpload::make('delivery_scan')
->required(fn (Get $get) => $get('delivered') === true )
->columnSpan([
'md' => 2,
]),
i really can't play that
Thx mate, This got on my nerves 🙂
krekas
krekas17mo ago
It might be because of livewire 3 bug. There's a pr to fix it

Did you find this page helpful?