Skip to content

Commit

Permalink
Localization order (#141)
Browse files Browse the repository at this point in the history
* Update messages.php

* Update EnumServiceProvider.php
  • Loading branch information
rudashi committed Jun 7, 2020
1 parent e4e7f2e commit 1d398a0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions resources/lang/en/messages.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php

return [
'enum' => 'The value you have provided is not a valid enum instance.',
'enum_value' => 'The value you have entered is invalid.',
'enum_key' => 'The key you have entered is invalid.',
'enum' => __('The value you have provided is not a valid enum instance.'),
'enum_value' => __('The value you have entered is invalid.'),
'enum_key' => __('The key you have entered is invalid.'),
];
6 changes: 3 additions & 3 deletions src/EnumServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ private function bootValidators()
$enum = $parameters[0] ?? null;

return (new EnumKey($enum))->passes($attribute, $value);
}, __('laravelEnum::messages.enum_key'));
});

$this->app['validator']->extend('enum_value', function ($attribute, $value, $parameters, $validator) {
$enum = $parameters[0] ?? null;
Expand All @@ -68,13 +68,13 @@ private function bootValidators()
$strict = !! json_decode(strtolower($strict));

return (new EnumValue($enum, $strict))->passes($attribute, $value);
}, __('laravelEnum::messages.enum_value'));
});

$this->app['validator']->extend('enum', function ($attribute, $value, $parameters, $validator) {
$enum = $parameters[0] ?? null;

return (new Enum($enum))->passes($attribute, $value);
}, __('laravelEnum::messages.enum'));
});
}

/**
Expand Down

0 comments on commit 1d398a0

Please sign in to comment.