@@ -13,7 +13,7 @@ |
||
13 | 13 | { |
14 | 14 | public function handle(HasAsset $model, MediaField $field, array $input, array $files): void |
15 | 15 | { |
16 | - foreach ([data_get($files, 'images.' . $field->getName(), []), data_get($input, 'images.' . $field->getName(), [])] as $requestPayload) { |
|
16 | + foreach ([data_get($files, 'images.'.$field->getName(), []), data_get($input, 'images.'.$field->getName(), [])] as $requestPayload) { |
|
17 | 17 | foreach ($requestPayload as $locale => $values) { |
18 | 18 | $this->handlePayload($model, $field, $locale, $values); |
19 | 19 | } |
@@ -31,12 +31,12 @@ discard block |
||
31 | 31 | { |
32 | 32 | [$input, $files] = $this->removeDuplicateFilePayload($input, $files); |
33 | 33 | |
34 | - foreach($fields as $field){ |
|
35 | - if($this->detectCustomSaveMethod($field)) { |
|
34 | + foreach ($fields as $field) { |
|
35 | + if ($this->detectCustomSaveMethod($field)) { |
|
36 | 36 | continue; |
37 | 37 | } |
38 | 38 | |
39 | - if(!$field->isLocalized()) |
|
39 | + if (!$field->isLocalized()) |
|
40 | 40 | { |
41 | 41 | // Set standard non-localized attribute on the model |
42 | 42 | ($customSetMethod = $this->detectCustomSetMethod($field)) |
@@ -49,11 +49,11 @@ discard block |
||
49 | 49 | // Dynamic localized values or standard translated |
50 | 50 | // For standard translations we set value with the colon notation, e.g. title:en |
51 | 51 | Form::foreachTrans(data_get($input, 'trans', []), function($locale, $key, $value) use($field){ |
52 | - if($key !== $field->getColumn()) return; |
|
52 | + if ($key !== $field->getColumn()) return; |
|
53 | 53 | |
54 | - if($this->isFieldForDynamicValue($field)) { |
|
54 | + if ($this->isFieldForDynamicValue($field)) { |
|
55 | 55 | $this->setDynamic($key, $value, $locale); |
56 | - } else { |
|
56 | + }else { |
|
57 | 57 | $this->{$field->getColumn().':'.$locale} = $value; |
58 | 58 | } |
59 | 59 | }); |
@@ -62,8 +62,8 @@ discard block |
||
62 | 62 | $this->save(); |
63 | 63 | |
64 | 64 | // Custom save methods |
65 | - foreach($fields as $field){ |
|
66 | - if($customSaveMethod = $this->detectCustomSaveMethod($field)) { |
|
65 | + foreach ($fields as $field) { |
|
66 | + if ($customSaveMethod = $this->detectCustomSaveMethod($field)) { |
|
67 | 67 | $this->$customSaveMethod($field, $input, $files); |
68 | 68 | } |
69 | 69 | } |
@@ -76,8 +76,8 @@ discard block |
||
76 | 76 | |
77 | 77 | private function detectCustomSaveMethod(Field $field): ?string |
78 | 78 | { |
79 | - $saveMethodByKey = 'save' . ucfirst(Str::camel($field->getKey())) . 'Field'; |
|
80 | - $saveMethodByType = 'save' . ucfirst(Str::camel($field->getType()->get())) . 'Fields'; |
|
79 | + $saveMethodByKey = 'save'.ucfirst(Str::camel($field->getKey())).'Field'; |
|
80 | + $saveMethodByType = 'save'.ucfirst(Str::camel($field->getType()->get())).'Fields'; |
|
81 | 81 | |
82 | 82 | foreach ([$saveMethodByKey, $saveMethodByType] as $saveMethod) { |
83 | 83 | if (method_exists($this, $saveMethod)) { |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | |
91 | 91 | private function detectCustomSetMethod(Field $field): ?string |
92 | 92 | { |
93 | - $methodName = 'set' . ucfirst(Str::camel($field->getKey())) . 'Field'; |
|
93 | + $methodName = 'set'.ucfirst(Str::camel($field->getKey())).'Field'; |
|
94 | 94 | |
95 | 95 | return (method_exists($this, $methodName)) ? $methodName : null; |
96 | 96 | } |
@@ -121,8 +121,8 @@ discard block |
||
121 | 121 | $flatInput = Arr::dot($input); |
122 | 122 | $flatFiles = Arr::dot($files); |
123 | 123 | |
124 | - foreach($flatInput as $key => $entry) { |
|
125 | - if($this->isValidFile($entry) && array_key_exists($key, $flatFiles)) { |
|
124 | + foreach ($flatInput as $key => $entry) { |
|
125 | + if ($this->isValidFile($entry) && array_key_exists($key, $flatFiles)) { |
|
126 | 126 | Arr::forget($input, $key); |
127 | 127 | } |
128 | 128 | } |