You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Validator::validate() and Validator::valid() do not return the same list of valid data. Validator::validate() returns only the data that has passed a validation rule. Validator::valid() ALL data that did not explicitly fail a validation rule.
This may be an intentional feature, but maybe we ought to have this distinction in the docs somewhere, or a feature that lets you toggle this behaviour? The main use case is auto save, where you'd wanna only update/save whatever is currently validated.
Steps To Reproduce
Create two validators with the same data and rules, and call the two methods on them:
Thanks for reporting the problem you are encountering, but it looks like this is a question which may be better suited for a support channel. We only use this issue tracker for reporting bugs with the library itself. If you have a question on how to use functionality provided by this repository you can try one of the following channels:
I posted this here, because I believe this to be a bug in my own eyes, but I'm open to a statement from the Laravel team stating it's an intentional feature. Just feels really unintuitive/potentially unsafe to me, that these methods behave differently like this.
If it's intentional, I'll just go open a PR to add it to the docs.
Laravel Version
12.12.0
PHP Version
8.4.7, Zend Engine 4.4.7
Database Driver & Version
No response
Description
Validator::validate()
andValidator::valid()
do not return the same list of valid data.Validator::validate()
returns only the data that has passed a validation rule.Validator::valid()
ALL data that did not explicitly fail a validation rule.This may be an intentional feature, but maybe we ought to have this distinction in the docs somewhere, or a feature that lets you toggle this behaviour? The main use case is auto save, where you'd wanna only update/save whatever is currently validated.
Steps To Reproduce
Create two validators with the same data and rules, and call the two methods on them:
The text was updated successfully, but these errors were encountered: