Skip to content
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
19 changes: 19 additions & 0 deletions validation.md
Original file line number Diff line number Diff line change
Expand Up @@ -1075,6 +1075,7 @@ Below is a list of all available validation rules and their function:

[Between](#rule-between)
[Dimensions](#rule-dimensions)
[Encoding](#rule-encoding)
[Extensions](#rule-extensions)
[File](#rule-file)
[Image](#rule-image)
Expand Down Expand Up @@ -1575,6 +1576,24 @@ $request->validate([
> [!WARNING]
> The `dns` and `spoof` validators require the PHP `intl` extension.

<a name="rule-encoding"></a>
#### encoding:*encoding_type*

The field under validation must match the specified character encoding. This rule uses PHP's `mb_check_encoding` function to verify the encoding of the given file or string value. For convenience, the `encoding` rule may be constructed using Laravel's fluent file rule builder:

```php
use Illuminate\Support\Facades\Validator;
use Illuminate\Validation\Rules\File;

Validator::validate($input, [
'attachment' => [
'required',
File::types(['csv'])
->encoding('utf-8'),
],
]);
```

<a name="rule-ends-with"></a>
#### ends_with:_foo_,_bar_,...

Expand Down