diff --git a/validation.md b/validation.md index 931b79513e..1d4d4df2b2 100644 --- a/validation.md +++ b/validation.md @@ -1356,7 +1356,20 @@ You may also pass a custom confirmation field name. For example, `confirmed:repe #### contains:_foo_,_bar_,... -The field under validation must be an array that contains all of the given parameter values. +The field under validation must be an array that contains all of the given parameter values. Since this rule often requires you to `implode` an array, the `Rule::contains` 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::contains(['admin', 'editor']), + ], +]); +``` #### current_password