Skip to content

Commit 0e48455

Browse files
shaffe-frspawnia
andauthored
Ensure validation rules are always added (#327)
Co-authored-by: Benedikt Franke <[email protected]>
1 parent c0fcbc6 commit 0e48455

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

Diff for: src/EnumServiceProvider.php

+3-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ protected function bootCommands(): void
3939

4040
protected function bootValidators(): void
4141
{
42-
$this->app->afterResolving(ValidationFactory::class, function (ValidationFactory $validationFactory): void {
42+
$this->app->extend(ValidationFactory::class, function (ValidationFactory $validationFactory): ValidationFactory {
4343
$validationFactory->extend('enum_key', function (string $attribute, $value, array $parameters, $validator): bool {
4444
$enum = $parameters[0] ?? null;
4545

@@ -63,6 +63,8 @@ protected function bootValidators(): void
6363

6464
return (new Enum($enum))->passes($attribute, $value);
6565
}, __('laravelEnum::messages.enum'));
66+
67+
return $validationFactory;
6668
});
6769
}
6870

0 commit comments

Comments
 (0)