The field under validation will be excluded from the request data returned by the validate and validated methods.
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.
I dug a bit deeper and see that Laravel\Lumen\Routing\ProvidesConvenienceMethods has its own method extractInputFromRules, 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.
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.