Skip to content

Commit 0537422

Browse files
authored
Update README.md
1 parent bdf7c66 commit 0537422

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

README.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,21 @@ VolumeUnitEnum::MILLIGRAMS->isNotAny(['GRAMS', VolumeUnitEnum::TONNE]);
318318
VolumeUnitEnum::MILLIGRAMS->isNotAny([VolumeUnitEnum::GRAMS, VolumeUnitEnum::MILLIGRAMS]); // false
319319
```
320320

321+
### rule
322+
323+
The backed enums may be validated using Laravel's standard Enum validation rule - `new Illuminate\Validation\Rules\Enum(VolumeUnitEnum::class)`.
324+
This method a shortcut for the validation rule.
325+
326+
#### Usage
327+
```
328+
public function rules(): array
329+
{
330+
return [
331+
'volume_unit' => [VolumeUnitEnum::rule()],
332+
];
333+
}
334+
```
335+
321336
## Changelog
322337

323338
Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

0 commit comments

Comments
 (0)