From dda49a744e3d1b4a9f926f96dbc228eccce2ada8 Mon Sep 17 00:00:00 2001 From: Amir Hossein Shokri Date: Thu, 31 Jul 2025 08:30:29 +0330 Subject: [PATCH 1/2] add doesntContain validation docs --- validation.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/validation.md b/validation.md index 53cdb140f9..e7290b0b9f 100644 --- a/validation.md +++ b/validation.md @@ -1042,6 +1042,7 @@ Below is a list of all available validation rules and their function: [Array](#rule-array) [Between](#rule-between) [Contains](#rule-contains) +[Doesnt Contain](#rule-doesnt-contain) [Distinct](#rule-distinct) [In Array](#rule-in-array) [In Array Keys](#rule-in-array-keys) @@ -1377,6 +1378,24 @@ Validator::make($data, [ ]); ``` + +#### doesnt_contain:_foo_,_bar_,... + +The field under validation must be an array that does not contain all of the given parameter values. Since this rule often requires you to `implode` an array, the `Rule::doesntContain` method may be used to fluently construct the rule: + +```php +use Illuminate\Support\Facades\Validator; +use Illuminate\Validation\Rule; + +Validator::make($data, [ + 'roles' => [ + 'required', + 'array', + Rule::doesntContain(['admin', 'editor']), + ], +]); +``` + #### current_password From 0f778f539b559ba9593eafd66bbee78a16ea284f Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Sun, 3 Aug 2025 10:12:30 -0500 Subject: [PATCH 2/2] Update validation.md --- validation.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/validation.md b/validation.md index e7290b0b9f..80936436d0 100644 --- a/validation.md +++ b/validation.md @@ -1381,7 +1381,7 @@ Validator::make($data, [ #### doesnt_contain:_foo_,_bar_,... -The field under validation must be an array that does not contain all of the given parameter values. Since this rule often requires you to `implode` an array, the `Rule::doesntContain` method may be used to fluently construct the rule: +The field under validation must be an array that does not contain any of the given parameter values. Since this rule often requires you to `implode` an array, the `Rule::doesntContain` method may be used to fluently construct the rule: ```php use Illuminate\Support\Facades\Validator;