check if currency code is string
This commit is contained in:
		@@ -19,10 +19,14 @@ class ValidationServiceProvider extends ServiceProvider
 | 
			
		||||
 | 
			
		||||
        Validator::extend('currency', function ($attribute, $value, $parameters, $validator) use(&$currency_code) {
 | 
			
		||||
            $status = false;
 | 
			
		||||
            
 | 
			
		||||
            if (!is_string($value) || (strlen($value) != 3)) {
 | 
			
		||||
                return $status;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            $currencies = Currency::enabled()->pluck('name', 'code')->toArray();
 | 
			
		||||
            $currencies = Currency::enabled()->pluck('code')->toArray();
 | 
			
		||||
 | 
			
		||||
            if (array_key_exists($value, $currencies)) {
 | 
			
		||||
            if (in_array($value, $currencies)) {
 | 
			
		||||
                $status = true;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user