Skip to content

Commit

Permalink
Merge pull request #50 from boobusy/doc
Browse files Browse the repository at this point in the history
  • Loading branch information
inhere committed Nov 15, 2021
2 parents c72b7b3 + 1949a7b commit d2397ed
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -570,12 +570,23 @@ $v->validate();

```php
['users.*.id', 'each', 'required', 'isEmpty' => function($value) {
if ($value instanceof \Inhere\Validate\ArrayValueNotExists) {
if ($value instanceof \Inhere\Validate\Exception\ArrayValueNotExists) {
return true;
}
// your code here ...
}]
```
规则包含 .* 时的自定义验证,如: users.*.id
```php
['users.*.id', 'string', 'isEmpty' => function(array $value) {
foreach ($value as $item) {
if ($item instanceof \Inhere\Validate\Exception\ArrayValueNotExists) {
return true;
}
// your code here ...
}
}]
```

### `filter` -- 使用过滤器

Expand Down

0 comments on commit d2397ed

Please sign in to comment.