@@ -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 | } |
@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | |
| 113 | 113 | private function saveImageFields(ImageField $field, array $input) |
| 114 | 114 | { |
| 115 | - app(ImageFieldHandler::class)->handle($this, $field, data_get($input, 'images.' . $field->getName(), []), $input); |
|
| 115 | + app(ImageFieldHandler::class)->handle($this, $field, data_get($input, 'images.'.$field->getName(), []), $input); |
|
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | private function removeDuplicateFilePayload($input, $files): array |
@@ -120,8 +120,8 @@ discard block |
||
| 120 | 120 | $flatInput = Arr::dot($input); |
| 121 | 121 | $flatFiles = Arr::dot($files); |
| 122 | 122 | |
| 123 | - foreach($flatInput as $key => $entry) { |
|
| 124 | - if($this->isValidFile($entry) && array_key_exists($key, $flatFiles)) { |
|
| 123 | + foreach ($flatInput as $key => $entry) { |
|
| 124 | + if ($this->isValidFile($entry) && array_key_exists($key, $flatFiles)) { |
|
| 125 | 125 | Arr::forget($input, $key); |
| 126 | 126 | } |
| 127 | 127 | } |