#i have an issue with validation

5 messages · Page 1 of 1 (latest)

visual bloom
#

i have a field that should be required only when another field is present and iam using the 'required_with' rule but because iam using livewire the field is always present but is null when its not used
but that's the issue because its set to null laravel thinks its present and the required_with rule passes

is there a way for laravel to ignore a field if its value is null? or how should i deal with it?

sharp dirge
#

Would "required_unless:field, null" work for you?

visual bloom
#

ok iam confused now

visual bloom
#

because the other field is null yet its still falling 💀