scribe
scribe copied to clipboard
feat: add support to 'sometimes' rule
Hello,
I added the support for the "sometimes" validator rule that allow to skip all following validators like "required".
Currently, a field with this following rules was consired as required (but it shouldn't) :
-
'consent_cgu' => 'sometimes|accepted' -
'other_field' => 'sometimes|required|...'("filled" rule seems better for this case but "filled_if", "filled_with", ... not existing so it's not an universal solution).
It notably fix this issue without any change to follow Laravel behaviour : https://github.com/knuckleswtf/scribe/issues/343
As Laravel behaviour, the following rules is correctly returned as required : 'badrule'=> 'required|sometimes|...'
Best regard