@@ -38,7 +38,7 @@ |
||
| 38 | 38 | return $closure($this->validatorFactory, $data); |
| 39 | 39 | } |
| 40 | 40 | |
| 41 | - if($field->ofType(FieldType::MEDIA)) { |
|
| 41 | + if ($field->ofType(FieldType::MEDIA)) { |
|
| 42 | 42 | $this->validatorFactory->resolver($this->container->make(MediaValidatorResolver::class)->resolvingClosure()); |
| 43 | 43 | |
| 44 | 44 | return $this->validatorFactory->make($data, |
@@ -15,7 +15,7 @@ discard block |
||
| 15 | 15 | |
| 16 | 16 | public function resolvingClosure(): \Closure |
| 17 | 17 | { |
| 18 | - return function($translator, $data, $rules, $messages, $customAttributes){ |
|
| 18 | + return function($translator, $data, $rules, $messages, $customAttributes) { |
|
| 19 | 19 | return $this->resolve($translator, $data, $rules, $messages, $customAttributes); |
| 20 | 20 | }; |
| 21 | 21 | } |
@@ -23,7 +23,7 @@ discard block |
||
| 23 | 23 | public function resolve(Translator $translator, $data, $rules, $messages, $customAttributes) |
| 24 | 24 | { |
| 25 | 25 | // trap($rules); |
| 26 | - foreach($rules as $key => $value) { |
|
| 26 | + foreach ($rules as $key => $value) { |
|
| 27 | 27 | $rules[$key] = is_string($value) ? explode('|', $value) : $value; |
| 28 | 28 | } |
| 29 | 29 | // if(is_string($value) && Str::startsWith($value, $this->whitelistedRules)) { |
@@ -6,26 +6,26 @@ discard block |
||
| 6 | 6 | { |
| 7 | 7 | public function validate($attribute, $value, $params, $validator): bool |
| 8 | 8 | { |
| 9 | - if(!$file = $this->retrieveFileFromRequest($attribute, $validator->attributes())) { |
|
| 9 | + if (!$file = $this->retrieveFileFromRequest($attribute, $validator->attributes())) { |
|
| 10 | 10 | return false; |
| 11 | 11 | } |
| 12 | 12 | trap($file); |
| 13 | - if(!$value) return false; |
|
| 13 | + if (!$value) return false; |
|
| 14 | 14 | |
| 15 | 15 | trap($attribute, $value, $params); |
| 16 | 16 | return false; |
| 17 | - if(!isset($validator->attributes()['files'])) return false; |
|
| 18 | - if(!isset($validator->attributes()['files'][$attribute])) return false; |
|
| 17 | + if (!isset($validator->attributes()['files'])) return false; |
|
| 18 | + if (!isset($validator->attributes()['files'][$attribute])) return false; |
|
| 19 | 19 | |
| 20 | 20 | $values = $validator->attributes()['files'][$attribute]; |
| 21 | 21 | |
| 22 | - foreach($values as $locale => $value) |
|
| 22 | + foreach ($values as $locale => $value) |
|
| 23 | 23 | { |
| 24 | 24 | $new = isset($value['new']) ? count($value['new']) : 0; |
| 25 | 25 | $replace = isset($value['replace']) ? count($value['replace']) : 0; |
| 26 | 26 | $delete = isset($value['delete']) ? count($value['delete']) : 0; |
| 27 | 27 | |
| 28 | - if ($new + $replace - $delete > 0) { |
|
| 28 | + if ($new+$replace-$delete > 0) { |
|
| 29 | 29 | return true; |
| 30 | 30 | } |
| 31 | 31 | |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | { |
| 38 | 38 | trap($values['files'][$attribute]); |
| 39 | 39 | |
| 40 | - if(!isset($values['files'], $values['files'][$attribute])) return null; |
|
| 40 | + if (!isset($values['files'], $values['files'][$attribute])) return null; |
|
| 41 | 41 | |
| 42 | 42 | return $values['files'][$attribute]; |
| 43 | 43 | } |
@@ -10,12 +10,18 @@ discard block |
||
| 10 | 10 | return false; |
| 11 | 11 | } |
| 12 | 12 | trap($file); |
| 13 | - if(!$value) return false; |
|
| 13 | + if(!$value) { |
|
| 14 | + return false; |
|
| 15 | + } |
|
| 14 | 16 | |
| 15 | 17 | trap($attribute, $value, $params); |
| 16 | 18 | return false; |
| 17 | - if(!isset($validator->attributes()['files'])) return false; |
|
| 18 | - if(!isset($validator->attributes()['files'][$attribute])) return false; |
|
| 19 | + if(!isset($validator->attributes()['files'])) { |
|
| 20 | + return false; |
|
| 21 | + } |
|
| 22 | + if(!isset($validator->attributes()['files'][$attribute])) { |
|
| 23 | + return false; |
|
| 24 | + } |
|
| 19 | 25 | |
| 20 | 26 | $values = $validator->attributes()['files'][$attribute]; |
| 21 | 27 | |
@@ -37,7 +43,9 @@ discard block |
||
| 37 | 43 | { |
| 38 | 44 | trap($values['files'][$attribute]); |
| 39 | 45 | |
| 40 | - if(!isset($values['files'], $values['files'][$attribute])) return null; |
|
| 46 | + if(!isset($values['files'], $values['files'][$attribute])) { |
|
| 47 | + return null; |
|
| 48 | + } |
|
| 41 | 49 | |
| 42 | 50 | return $values['files'][$attribute]; |
| 43 | 51 | } |