Skip to content

Commit 07ca01f

Browse files
committedMay 7, 2025
formatting
1 parent 88c3f8c commit 07ca01f

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed
 

‎validation.md

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1677,13 +1677,10 @@ You may explicitly specify the database column name that should be used by the `
16771677
'state' => Rule::exists('states', 'abbreviation'),
16781678
```
16791679

1680-
<a name="validate-an-array-of-values-against-database"></a>
1681-
#### Validating an Array of Values
1682-
16831680
Sometimes, you may wish to validate whether an array of values exists in the database. You can do so by adding both the `exists` and [array](#rule-array) rules to the field being validated:
16841681

16851682
```php
1686-
'user_ids' => ['array', 'exists:users,id'],
1683+
'states' => ['array', Rule::exists('states', 'abbreviation')],
16871684
```
16881685

16891686
When both of these rules are assigned to a field, Laravel will automatically build a single query to determine if all of the given values exist in the specified table.

0 commit comments

Comments
 (0)
Please sign in to comment.