From d3f8c85e60f174279fcfff6709557c44a3e745e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=BCneyt=20=C5=9Eent=C3=BCrk?= Date: Thu, 26 Sep 2024 09:45:51 +0100 Subject: [PATCH] change request rule message format.. --- src/Provider.php | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/Provider.php b/src/Provider.php index e07d679..c32dacf 100644 --- a/src/Provider.php +++ b/src/Provider.php @@ -36,13 +36,9 @@ public function boot(): void public function registerValidationRules(): void { - $currency_code = null; - - Validator::extend('currency_code', function ($attribute, $value, $parameters, $validator) use(&$currency_code) { + Validator::extend('currency_code', function ($attribute, $value, $parameters, $validator) { $status = false; - $currency_code = $value; - $currencies = config('money.currencies'); if (array_key_exists($value, $currencies)) { @@ -50,9 +46,11 @@ public function registerValidationRules(): void } return $status; - }, - trans('validation.custom.invalid_currency', ['attribute' => $currency_code]) - ); + }); + + Validator::replacer('currency_code', function($message, $attribute, $rule, $parameters) { + return trans('validation.custom.invalid_currency', ['attribute' => $attribute]); + }); } public function registerBladeDirectives(): void