We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | foreach (app('UploadersRepository')->getRepeatableUploadersFor($this->getRepeatableContainerName()) as $uploader) { |
77 | 77 | $uploadedValues = $uploader->uploadRepeatableFiles($values->pluck($uploader->getAttributeName())->toArray(), $this->getPreviousRepeatableValues($entry, $uploader)); |
78 | 78 | |
79 | - $values = $values->map(function ($item, $key) use ($uploadedValues, $uploader) { |
|
79 | + $values = $values->map(function($item, $key) use ($uploadedValues, $uploader) { |
|
80 | 80 | $item[$uploader->getAttributeName()] = $uploadedValues[$key] ?? null; |
81 | 81 | |
82 | 82 | return $item; |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | |
97 | 97 | $values = $entry->{$this->getRepeatableContainerName()}; |
98 | 98 | $values = is_string($values) ? json_decode($values, true) : $values; |
99 | - $values = array_map(function ($item) use ($repeatableUploaders) { |
|
99 | + $values = array_map(function($item) use ($repeatableUploaders) { |
|
100 | 100 | foreach ($repeatableUploaders as $upload) { |
101 | 101 | $item[$upload->getAttributeName()] = $this->getValuesWithPathStripped($item, $upload); |
102 | 102 | } |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | |
112 | 112 | private function retrieveRepeatableRelationFiles(Model $entry) |
113 | 113 | { |
114 | - switch($this->getRepeatableRelationType()) { |
|
114 | + switch ($this->getRepeatableRelationType()) { |
|
115 | 115 | case 'BelongsToMany': |
116 | 116 | $pivotClass = app('crud')->getModel()->{$this->getUploaderSubfield()['baseEntity']}()->getPivotClass(); |
117 | 117 | $pivotFieldName = 'pivot_'.$this->getAttributeName(); |
@@ -149,22 +149,22 @@ discard block |
||
149 | 149 | private function deleteRepeatableFiles(Model $entry): void |
150 | 150 | { |
151 | 151 | if ($this->isRelationship) { |
152 | - switch($this->getRepeatableRelationType()) { |
|
152 | + switch ($this->getRepeatableRelationType()) { |
|
153 | 153 | case 'BelongsToMany': |
154 | 154 | $pivotAttributes = $entry->getAttributes(); |
155 | - $connectedPivot = $entry->pivotParent->{$this->getRepeatableContainerName()}->where(function ($item) use ($pivotAttributes) { |
|
155 | + $connectedPivot = $entry->pivotParent->{$this->getRepeatableContainerName()}->where(function($item) use ($pivotAttributes) { |
|
156 | 156 | $itemPivotAttributes = $item->pivot->only(array_keys($pivotAttributes)); |
157 | 157 | |
158 | 158 | return $itemPivotAttributes === $pivotAttributes; |
159 | 159 | })->first(); |
160 | 160 | |
161 | - if (! $connectedPivot) { |
|
161 | + if (!$connectedPivot) { |
|
162 | 162 | return; |
163 | 163 | } |
164 | 164 | |
165 | 165 | $files = $connectedPivot->getOriginal()['pivot_'.$this->getAttributeName()]; |
166 | 166 | |
167 | - if (! $files) { |
|
167 | + if (!$files) { |
|
168 | 168 | return; |
169 | 169 | } |
170 | 170 | |
@@ -190,12 +190,12 @@ discard block |
||
190 | 190 | |
191 | 191 | $repeatableValues = collect($entry->{$this->getName()}); |
192 | 192 | foreach (app('UploadersRepository')->getRepeatableUploadersFor($this->getRepeatableContainerName()) as $upload) { |
193 | - if (! $upload->shouldDeleteFiles()) { |
|
193 | + if (!$upload->shouldDeleteFiles()) { |
|
194 | 194 | continue; |
195 | 195 | } |
196 | 196 | $values = $repeatableValues->pluck($upload->getName())->toArray(); |
197 | 197 | foreach ($values as $value) { |
198 | - if (! $value) { |
|
198 | + if (!$value) { |
|
199 | 199 | continue; |
200 | 200 | } |
201 | 201 | |
@@ -218,7 +218,7 @@ discard block |
||
218 | 218 | /** |
219 | 219 | * Given two multidimensional arrays/collections, merge them recursively. |
220 | 220 | */ |
221 | - protected function mergeValuesRecursive(array|Collection $array1, array|Collection $array2): array|Collection |
|
221 | + protected function mergeValuesRecursive(array | Collection $array1, array | Collection $array2): array | Collection |
|
222 | 222 | { |
223 | 223 | $merged = $array1; |
224 | 224 | foreach ($array2 as $key => &$value) { |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | { |
241 | 241 | $items = CRUD::getRequest()->input('_order_'.$this->getRepeatableContainerName()) ?? []; |
242 | 242 | |
243 | - array_walk($items, function (&$key, $value) { |
|
243 | + array_walk($items, function(&$key, $value) { |
|
244 | 244 | $requestValue = $key[$this->getName()] ?? null; |
245 | 245 | $key = $this->handleMultipleFiles ? (is_string($requestValue) ? explode(',', $requestValue) : $requestValue) : $requestValue; |
246 | 246 | }); |
@@ -252,18 +252,18 @@ discard block |
||
252 | 252 | { |
253 | 253 | $previousValues = json_decode($entry->getOriginal($uploader->getRepeatableContainerName()), true); |
254 | 254 | |
255 | - if (! empty($previousValues)) { |
|
255 | + if (!empty($previousValues)) { |
|
256 | 256 | $previousValues = array_column($previousValues, $uploader->getName()); |
257 | 257 | } |
258 | 258 | |
259 | 259 | return $previousValues ?? []; |
260 | 260 | } |
261 | 261 | |
262 | - private function getValuesWithPathStripped(array|string|null $item, UploaderInterface $upload) |
|
262 | + private function getValuesWithPathStripped(array | string | null $item, UploaderInterface $upload) |
|
263 | 263 | { |
264 | 264 | $uploadedValues = $item[$upload->getName()] ?? null; |
265 | 265 | if (is_array($uploadedValues)) { |
266 | - return array_map(function ($value) use ($upload) { |
|
266 | + return array_map(function($value) use ($upload) { |
|
267 | 267 | return Str::after($value, $upload->getPath()); |
268 | 268 | }, $uploadedValues); |
269 | 269 | } |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | return $this->getPath().$fileName; |
24 | 24 | } |
25 | 25 | |
26 | - if (! $value && CrudPanelFacade::getRequest()->has($this->getRepeatableContainerName() ?? $this->getName()) && $previousFile) { |
|
26 | + if (!$value && CrudPanelFacade::getRequest()->has($this->getRepeatableContainerName() ?? $this->getName()) && $previousFile) { |
|
27 | 27 | Storage::disk($this->getDisk())->delete($previousFile); |
28 | 28 | |
29 | 29 | return null; |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | } |
48 | 48 | |
49 | 49 | foreach ($previousRepeatableValues as $row => $file) { |
50 | - if ($file && ! isset($orderedFiles[$row])) { |
|
50 | + if ($file && !isset($orderedFiles[$row])) { |
|
51 | 51 | $orderedFiles[$row] = null; |
52 | 52 | Storage::disk($this->getDisk())->delete($file); |
53 | 53 | } |