-
Notifications
You must be signed in to change notification settings - Fork 418
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
excludeIf validation rule does not work as expected when using $this->validate from controller #1247
Comments
Yes, feel free to send in a PR, thanks! |
MattApril
added a commit
to MattApril/lumen-framework
that referenced
this issue
Sep 9, 2022
taylorotwell
added a commit
that referenced
this issue
Sep 12, 2022
… (#1248) * Change controller validate helper method to behave like Laravel (#1247) * Set response on validation exception, which is expected by exception handler. * Remove used import * style conformity * Add backwards compatibility for removed methods: extractInputFromRules and throwValidationException * Cleanup * code style * Update ProvidesConvenienceMethods.php Co-authored-by: Taylor Otwell <taylor@laravel.com>
taylorotwell
pushed a commit
that referenced
this issue
Sep 15, 2022
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Description:
According to Laravel docs:
In Lumen, this is not the case, and there is nothing stating so in the docs. It does respect the rule when applying other validation rules (a non-numeric value could but submitted in the example below), but it does not respect it when returning the validated data.
Steps To Reproduce:
Expected output:
FALSE
Actual output:
TRUE
Suggestion
I dug a bit deeper and see that
Laravel\Lumen\Routing\ProvidesConvenienceMethods
has its own methodextractInputFromRules
, which clearly does not factor in the exclude_if validation rule at all. My question is, why not just simplify the validate method to do exactly what Laravel does:I overrode the method in my application and all my tests are still passing. I have to assume it was done differently in Lumen for a reason, but I'm happy to submit a pull request if the above is acceptable.
The text was updated successfully, but these errors were encountered: