-
Notifications
You must be signed in to change notification settings - Fork 11.1k
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
$request->validated() doesn't include all validated attributes #24607
Comments
@crashkonijn You can perhaps submit a PR with the fix (since you've already managed to fix it on your end :)) and add a unit test to ensure it's really fixed and to also avoid regression later. |
Hi there @brunogaspar, I will give it a try as soon as I have time. The reason I didn't yet do it because I don't understand exactly what '$this->container->call([$this, 'rules'])' does, and why it wasn't was '$this->getValidatorInstance()->getRules()' to begin with. Anyway, I guess that I'd then also have to add the getRules() function to 'Illuminate\Contracts\Validation\Validator' right? |
It is done in this way |
Hi @tautvydasr, Thanks for your explanation! If I understand you correctly then my fix will introduce other problems right? |
Honestly, i'm not sure it matters much because in the end what the But i can be wrong though :) |
But potentially if
Edited: But as I see when creating default validator resolved rules should be passed so I guess provided solution can be valid.
|
Easy PR since the author did practically 90% of the work. It's just a matter of writing tests now. |
This issue is fixed😀 |
Awesome, thanks! |
Description:
$request->validated() only includes the attributes which have been defined in the Request->rules() function, not those who have been added via $validator->sometimes()
Steps To Reproduce:
Validated won't include the password, even though it does get actually validated.
Possible fix
Making this change in FormRequest fixes the issue:
The text was updated successfully, but these errors were encountered: