We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
In order to validate a collection of data, it would be helpful to have a CollectionRule that accepts a list of rules as follow:
$rules = [ ['email', EmailRule::class, EmailRule::REQUIRED => true], ['tags', CollectionRule::class, CollectionRule::RULES => [ ['code', NumericRule::class, NumericRule::MAX => 80], ['slug', MatchRule::class, MatchRule::PATTERN => '/^[a-z]{1,5}$/i'], ]], ]; $data = [ 'email' => 'elie29@gmail.com', 'tags' => [ ['code' => 12, 'slug' => 'one'], ['code' => 13, 'slug' => 'two'], ['code' => 15, 'slug' => 'three'], ], ]; $validator = new Validator($data, $rules); assertThat($validator->validate(), is(true)); $tags = $validator->getValidatedContext()['tags']; assertThat($tags, arrayWithSize(3));
The text was updated successfully, but these errors were encountered:
✨ Add a collection rule to validate collection data #28
07ce0a7
📚 Add a collection rule to validate collection data #28
ba04fbc
f08beb2
Add a collection rule to validate collection data #28
a309c94
elie29
No branches or pull requests
In order to validate a collection of data, it would be helpful to have a CollectionRule that accepts a list of rules as follow:
The text was updated successfully, but these errors were encountered: