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
Each - applying the same rules for each data item in the set
The Each rule allows the same rules to be applied to each data item in the set. The following example shows
the configuration for validating RGB color components:
By combining with another built-in rule called Count we can be sure that the number of components is exactly 3:
useYiisoft\Validator\Rule\Count;
useYiisoft\Validator\Rule\Each;
useYiisoft\Validator\Rule\Integer;
$rules = [
// Applies to a whole set.newCount(3),
// Applies to individual set items.newEach(
// For single rules, wrapping with array / iterable is not necessary.newInteger(min: 0, max: 255),
),
];
For more information about using it with Nested, see the Nested guide.
The text was updated successfully, but these errors were encountered:
Blocks of code often contain comments. Can I add them for translation?
Example of .md below and in attached file:
Each
- applying the same rules for each data item in the setThe
Each
rule allows the same rules to be applied to each data item in the set. The following example showsthe configuration for validating RGB color components:
By combining with another built-in rule called
Count
we can be sure that the number of components is exactly 3:For more information about using it with
Nested
, see the Nested guide.The text was updated successfully, but these errors were encountered: