Skip to content

Update validation.md #695

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 7, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 26 additions & 1 deletion validation.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
git: 16978eb4f5adeb0a1106895336a07b902cf062b4
git: 133fd4a47a9fa2bda7332f02d4d051d214d98285
---

# Валидация
Expand Down Expand Up @@ -997,6 +997,7 @@ Validator::make($request->all(), [
- [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)
Expand Down Expand Up @@ -1328,6 +1329,24 @@ Validator::make($data, [
]);
```

<a name="rule-doesnt-contain"></a>
#### doesnt_contain:_foo_,_bar_,...

Проверяемое поле должно быть массивом, не содержащим ни одного из заданных значений параметров. Поскольку это правило часто требует «развертывания» массива, для его быстрого построения можно использовать метод `Rule::doesntContain`:

```php
use Illuminate\Support\Facades\Validator;
use Illuminate\Validation\Rule;

Validator::make($data, [
'roles' => [
'required',
'array',
Rule::doesntContain(['admin', 'editor']),
],
]);
```

<a name="rule-current-password"></a>
#### current_password

Expand Down Expand Up @@ -1756,6 +1775,12 @@ Validator::make($input, [

Проверяемое поле должно быть целым числом.

Вы можете использовать параметр `strict`, чтобы считать поле допустимым только в том случае, если его тип — `integer`. Строки с целыми значениями будут считаться недопустимыми:

```php
'age' => 'integer:strict'
```

> [!WARNING]
> Это правило валидации не проверяет, что значение поля относится к типу переменной `integer`, а только что значение поля относится к типу, принятому правилом `FILTER_VALIDATE_INT` PHP. Если вам нужно проверить значение поля в качестве числа, используйте это правило в сочетании с [правилом валидации `numeric`](#rule-numeric).

Expand Down