Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add support to 'sometimes' rule #958

Open
wants to merge 2 commits into
base: v5
Choose a base branch
from

Conversation

max13fr
Copy link
Contributor

@max13fr max13fr commented Feb 25, 2025

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 : #343

As Laravel behaviour, the following rules is correctly returned as required : 'badrule'=> 'required|sometimes|...'

Best regard

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant