From 0537422543c96cb484b143ccb64c62f7ec1c86c6 Mon Sep 17 00:00:00 2001 From: Matthew Hailwood Date: Thu, 5 Oct 2023 11:29:01 +1300 Subject: [PATCH] Update README.md --- README.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/README.md b/README.md index 1415775..e13a6f2 100644 --- a/README.md +++ b/README.md @@ -318,6 +318,21 @@ VolumeUnitEnum::MILLIGRAMS->isNotAny(['GRAMS', VolumeUnitEnum::TONNE]); VolumeUnitEnum::MILLIGRAMS->isNotAny([VolumeUnitEnum::GRAMS, VolumeUnitEnum::MILLIGRAMS]); // false ``` +### rule + +The backed enums may be validated using Laravel's standard Enum validation rule - `new Illuminate\Validation\Rules\Enum(VolumeUnitEnum::class)`. +This method a shortcut for the validation rule. + +#### Usage +``` +public function rules(): array +{ + return [ + 'volume_unit' => [VolumeUnitEnum::rule()], + ]; +} +``` + ## Changelog Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.