Skip to content

Commit d3f8c85

Browse files
committed
change request rule message format..
1 parent d99a9e8 commit d3f8c85

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

src/Provider.php

+6-8
Original file line numberDiff line numberDiff line change
@@ -36,23 +36,21 @@ public function boot(): void
3636

3737
public function registerValidationRules(): void
3838
{
39-
$currency_code = null;
40-
41-
Validator::extend('currency_code', function ($attribute, $value, $parameters, $validator) use(&$currency_code) {
39+
Validator::extend('currency_code', function ($attribute, $value, $parameters, $validator) {
4240
$status = false;
4341

44-
$currency_code = $value;
45-
4642
$currencies = config('money.currencies');
4743

4844
if (array_key_exists($value, $currencies)) {
4945
$status = true;
5046
}
5147

5248
return $status;
53-
},
54-
trans('validation.custom.invalid_currency', ['attribute' => $currency_code])
55-
);
49+
});
50+
51+
Validator::replacer('currency_code', function($message, $attribute, $rule, $parameters) {
52+
return trans('validation.custom.invalid_currency', ['attribute' => $attribute]);
53+
});
5654
}
5755

5856
public function registerBladeDirectives(): void

0 commit comments

Comments
 (0)