Skip to content

Commit 7457dd7

Browse files
committed
document any of
1 parent 72904db commit 7457dd7

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

Diff for: validation.md

+18
Original file line numberDiff line numberDiff line change
@@ -1096,6 +1096,7 @@ Below is a list of all available validation rules and their function:
10961096

10971097
<div class="collection-method-list" markdown="1">
10981098

1099+
[Any Of](#rule-anyof)
10991100
[Bail](#rule-bail)
11001101
[Exclude](#rule-exclude)
11011102
[Exclude If](#rule-exclude-if)
@@ -1198,6 +1199,23 @@ use Illuminate\Validation\Rule;
11981199
],
11991200
```
12001201

1202+
<a name="rule-anyof"></a>
1203+
#### anyOf
1204+
1205+
The `Rule::anyOf` validation rule allows you to specify that the field under validation must satisfy any of the given validation rulesets. For example, the following rule will validate that the `username` field is either an email address or an alpha-numeric string (including dashes) that is at least 6 characters long:
1206+
1207+
```php
1208+
use Illuminate\Validation\Rule;
1209+
1210+
'username' => [
1211+
'required',
1212+
Rule::anyOf([
1213+
['string', 'email'],
1214+
['string', 'alpha_dash', 'min:6'],
1215+
]),
1216+
],
1217+
```
1218+
12011219
<a name="rule-alpha"></a>
12021220
#### alpha
12031221

0 commit comments

Comments
 (0)