diff --git a/validation.md b/validation.md index 7bab3e70fda..dba40cebb4c 100644 --- a/validation.md +++ b/validation.md @@ -172,7 +172,17 @@ $request->validate([ 'author.description' => 'required', ]); ``` + +#### Distinct Rule for Arrays +You can ensure that all values in an array input are unique by using the `distinct` validation rule. For example: + +```php +$request->validate([ + 'tags' => ['required', 'array'], + 'tags.*' => ['string', 'distinct'], +]); +``` On the other hand, if your field name contains a literal period, you can explicitly prevent this from being interpreted as "dot" syntax by escaping the period with a backslash: ```php