|
@@ -45,8 +45,8 @@ discard block |
|
|
block discarded – undo |
|
45
|
45
|
if (Schema::hasTable(config('twill.related_table', 'related'))) { |
|
46
|
46
|
$relatedItems = Collection::make(); |
|
47
|
47
|
|
|
48
|
|
- Collection::make($fields['browsers'])->each(function ($items, $browserName) use ($object, &$relatedItems) { |
|
49
|
|
- Collection::make($items)->each(function ($item) use ($browserName, &$relatedItems) { |
|
|
48
|
+ Collection::make($fields['browsers'])->each(function($items, $browserName) use ($object, &$relatedItems) { |
|
|
49
|
+ Collection::make($items)->each(function($item) use ($browserName, &$relatedItems) { |
|
50
|
50
|
try { |
|
51
|
51
|
$repository = $this->getModelRepository($item['endpointType'] ?? $browserName); |
|
52
|
52
|
$relatedItems->push((object) [ |
|
@@ -74,7 +74,7 @@ discard block |
|
|
block discarded – undo |
|
74
|
74
|
{ |
|
75
|
75
|
if (Schema::hasTable(config('twill.related_table', 'related'))) { |
|
76
|
76
|
if (isset($fields['browsers'])) { |
|
77
|
|
- Collection::make($fields['browsers'])->each(function ($items, $browserName) use ($object) { |
|
|
77
|
+ Collection::make($fields['browsers'])->each(function($items, $browserName) use ($object) { |
|
78
|
78
|
$object->saveRelated($items, $browserName); |
|
79
|
79
|
}); |
|
80
|
80
|
} |
|
@@ -102,14 +102,14 @@ discard block |
|
|
block discarded – undo |
|
102
|
102
|
{ |
|
103
|
103
|
$blocksFromConfig = $this->config->get('twill.block_editor.' . ($repeater ? 'repeaters' : 'blocks')); |
|
104
|
104
|
|
|
105
|
|
- $block['type'] = Collection::make($blocksFromConfig)->search(function ($blockConfig) use ($block) { |
|
|
105
|
+ $block['type'] = Collection::make($blocksFromConfig)->search(function($blockConfig) use ($block) { |
|
106
|
106
|
return $blockConfig['component'] === $block['type']; |
|
107
|
107
|
}); |
|
108
|
108
|
|
|
109
|
109
|
$block['content'] = empty($block['content']) ? new \stdClass : (object) $block['content']; |
|
110
|
110
|
|
|
111
|
111
|
if ($block['browsers']) { |
|
112
|
|
- $browsers = Collection::make($block['browsers'])->map(function ($items) { |
|
|
112
|
+ $browsers = Collection::make($block['browsers'])->map(function($items) { |
|
113
|
113
|
return Collection::make($items)->pluck('id'); |
|
114
|
114
|
})->toArray(); |
|
115
|
115
|
|