php-validate
php-validate copied to clipboard
Improve eachValidator ?
trafficstars
Hi ! Thank you for this lib !
Is there a way to combine eachValidator with FieldValidation and filters ? Perhaps with something like this :
$v = Inhere\Validate\FieldValidation::check(['array' => [
[
'string' => " some words ",
'int' => "44",
], [
'string' => " some letters ",
'int' => " 456 ",
]
]], [
['array.*.int', 'each|required|int', 'filter' => 'int'],
['array.*.string', 'each|required|string', 'filter' => 'trim'],
]);
Bonus question : is there a way to get index/key in the errors array ? Currently we don't know which element is/are in error ?
0 => array:2 [▼
"name" => "array.*.int"
"msg" => "array.*.int must be through the int verify"
]
hi @yoh if use wildcard *, will skip apply filters. :(