@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | $blockRepository = app(BlockRepository::class); |
| 71 | 71 | |
| 72 | 72 | $blockRepository->bulkDelete($object->blocks()->pluck('id')->toArray()); |
| 73 | - $this->getBlocks($object, $fields)->each(function ($block) use ($object, $blockRepository) { |
|
| 73 | + $this->getBlocks($object, $fields)->each(function($block) use ($object, $blockRepository) { |
|
| 74 | 74 | $this->createBlock($blockRepository, $block); |
| 75 | 75 | }); |
| 76 | 76 | } |
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | $blockCreated = $blockRepository->create($blockFields); |
| 89 | 89 | |
| 90 | 90 | // Handle child blocks |
| 91 | - $blockFields['blocks']->each(function ($childBlock) use ($blockCreated, $blockRepository) { |
|
| 91 | + $blockFields['blocks']->each(function($childBlock) use ($blockCreated, $blockRepository) { |
|
| 92 | 92 | $childBlock['parent_id'] = $blockCreated->id; |
| 93 | 93 | $this->createBlock($blockRepository, $childBlock); |
| 94 | 94 | }); |
@@ -200,9 +200,9 @@ discard block |
||
| 200 | 200 | ]; |
| 201 | 201 | } |
| 202 | 202 | |
| 203 | - $fields['blocksFields'][] = Collection::make($block['content'])->filter(function ($value, $key) { |
|
| 203 | + $fields['blocksFields'][] = Collection::make($block['content'])->filter(function($value, $key) { |
|
| 204 | 204 | return $key !== "browsers"; |
| 205 | - })->map(function ($value, $key) use ($block) { |
|
| 205 | + })->map(function($value, $key) use ($block) { |
|
| 206 | 206 | return [ |
| 207 | 207 | 'name' => "blocks[$block->id][$key]", |
| 208 | 208 | 'value' => $value, |
@@ -215,15 +215,15 @@ discard block |
||
| 215 | 215 | |
| 216 | 216 | if ($medias) { |
| 217 | 217 | if (config('twill.media_library.translated_form_fields', false)) { |
| 218 | - $fields['blocksMedias'][] = Collection::make($medias)->mapWithKeys(function ($mediasByLocale, $locale) use ($block) { |
|
| 219 | - return Collection::make($mediasByLocale)->mapWithKeys(function ($value, $key) use ($block, $locale) { |
|
| 218 | + $fields['blocksMedias'][] = Collection::make($medias)->mapWithKeys(function($mediasByLocale, $locale) use ($block) { |
|
| 219 | + return Collection::make($mediasByLocale)->mapWithKeys(function($value, $key) use ($block, $locale) { |
|
| 220 | 220 | return [ |
| 221 | 221 | "blocks[$block->id][$key][$locale]" => $value, |
| 222 | 222 | ]; |
| 223 | 223 | }); |
| 224 | 224 | })->filter()->toArray(); |
| 225 | 225 | } else { |
| 226 | - $fields['blocksMedias'][] = Collection::make($medias)->mapWithKeys(function ($value, $key) use ($block) { |
|
| 226 | + $fields['blocksMedias'][] = Collection::make($medias)->mapWithKeys(function($value, $key) use ($block) { |
|
| 227 | 227 | return [ |
| 228 | 228 | "blocks[$block->id][$key]" => $value, |
| 229 | 229 | ]; |
@@ -234,8 +234,8 @@ discard block |
||
| 234 | 234 | $files = $blockFormFields['files']; |
| 235 | 235 | |
| 236 | 236 | if ($files) { |
| 237 | - Collection::make($files)->each(function ($rolesWithFiles, $locale) use (&$fields, $block) { |
|
| 238 | - $fields['blocksFiles'][] = Collection::make($rolesWithFiles)->mapWithKeys(function ($files, $role) use ($locale, $block) { |
|
| 237 | + Collection::make($files)->each(function($rolesWithFiles, $locale) use (&$fields, $block) { |
|
| 238 | + $fields['blocksFiles'][] = Collection::make($rolesWithFiles)->mapWithKeys(function($files, $role) use ($locale, $block) { |
|
| 239 | 239 | return [ |
| 240 | 240 | "blocks[$block->id][$role][$locale]" => $files, |
| 241 | 241 | ]; |
@@ -274,9 +274,9 @@ discard block |
||
| 274 | 274 | */ |
| 275 | 275 | protected function getBlockBrowsers($block) |
| 276 | 276 | { |
| 277 | - return Collection::make($block['content']['browsers'])->mapWithKeys(function ($ids, $relation) use ($block) { |
|
| 277 | + return Collection::make($block['content']['browsers'])->mapWithKeys(function($ids, $relation) use ($block) { |
|
| 278 | 278 | if (Schema::hasTable(config('twill.related_table', 'related')) && $block->getRelated($relation)->isNotEmpty()) { |
| 279 | - $items = $this->getFormFieldsForRelatedBrowser($block, $relation);; |
|
| 279 | + $items = $this->getFormFieldsForRelatedBrowser($block, $relation); ; |
|
| 280 | 280 | } else { |
| 281 | 281 | $relationRepository = $this->getModelRepository($relation); |
| 282 | 282 | $relatedItems = $relationRepository->get([], ['id' => $ids], [], -1); |
@@ -286,9 +286,9 @@ discard block |
||
| 286 | 286 | $sortedRelatedItems[$item->id] = $item; |
| 287 | 287 | } |
| 288 | 288 | |
| 289 | - $items = Collection::make(array_values($sortedRelatedItems))->filter(function ($value) { |
|
| 289 | + $items = Collection::make(array_values($sortedRelatedItems))->filter(function($value) { |
|
| 290 | 290 | return is_object($value); |
| 291 | - })->map(function ($relatedElement) use ($relation) { |
|
| 291 | + })->map(function($relatedElement) use ($relation) { |
|
| 292 | 292 | return [ |
| 293 | 293 | 'id' => $relatedElement->id, |
| 294 | 294 | 'name' => $relatedElement->titleInBrowser ?? $relatedElement->title, |