|
@@ -62,7 +62,7 @@ discard block |
|
|
block discarded – undo |
|
62
|
62
|
$relationRepository = $this->getModelRepository($relation, $model); |
|
63
|
63
|
|
|
64
|
64
|
if (!$keepExisting) { |
|
65
|
|
- $object->$relation()->each(function ($repeaterElement) { |
|
|
65
|
+ $object->$relation()->each(function($repeaterElement) { |
|
66
|
66
|
$repeaterElement->forceDelete(); |
|
67
|
67
|
}); |
|
68
|
68
|
} |
|
@@ -81,8 +81,8 @@ discard block |
|
|
block discarded – undo |
|
81
|
81
|
|
|
82
|
82
|
$morph = $morph ?: $relation; |
|
83
|
83
|
|
|
84
|
|
- $morphFieldType = $morph.'_type'; |
|
85
|
|
- $morphFieldId = $morph.'_id'; |
|
|
84
|
+ $morphFieldType = $morph . '_type'; |
|
|
85
|
+ $morphFieldId = $morph . '_id'; |
|
86
|
86
|
|
|
87
|
87
|
// if no relation field submitted, soft deletes all associated rows |
|
88
|
88
|
if (!$relationFields) { |
|
@@ -232,8 +232,8 @@ discard block |
|
|
block discarded – undo |
|
232
|
232
|
|
|
233
|
233
|
if (isset($relatedItemFormFields['medias'])) { |
|
234
|
234
|
if (config('twill.media_library.translated_form_fields', false)) { |
|
235
|
|
- Collection::make($relatedItemFormFields['medias'])->each(function ($rolesWithMedias, $locale) use (&$repeatersMedias, $relation, $relationItem) { |
|
236
|
|
- $repeatersMedias[] = Collection::make($rolesWithMedias)->mapWithKeys(function ($medias, $role) use ($locale, $relation, $relationItem) { |
|
|
235
|
+ Collection::make($relatedItemFormFields['medias'])->each(function($rolesWithMedias, $locale) use (&$repeatersMedias, $relation, $relationItem) { |
|
|
236
|
+ $repeatersMedias[] = Collection::make($rolesWithMedias)->mapWithKeys(function($medias, $role) use ($locale, $relation, $relationItem) { |
|
237
|
237
|
return [ |
|
238
|
238
|
"blocks[$relation-$relationItem->id][$role][$locale]" => $medias, |
|
239
|
239
|
]; |
|
@@ -247,8 +247,8 @@ discard block |
|
|
block discarded – undo |
|
247
|
247
|
} |
|
248
|
248
|
|
|
249
|
249
|
if (isset($relatedItemFormFields['files'])) { |
|
250
|
|
- Collection::make($relatedItemFormFields['files'])->each(function ($rolesWithFiles, $locale) use (&$repeatersFiles, $relation, $relationItem) { |
|
251
|
|
- $repeatersFiles[] = Collection::make($rolesWithFiles)->mapWithKeys(function ($files, $role) use ($locale, $relation, $relationItem) { |
|
|
250
|
+ Collection::make($relatedItemFormFields['files'])->each(function($rolesWithFiles, $locale) use (&$repeatersFiles, $relation, $relationItem) { |
|
|
251
|
+ $repeatersFiles[] = Collection::make($rolesWithFiles)->mapWithKeys(function($files, $role) use ($locale, $relation, $relationItem) { |
|
252
|
252
|
return [ |
|
253
|
253
|
"blocks[$relation-$relationItem->id][$role][$locale]" => $files, |
|
254
|
254
|
]; |
|
@@ -298,7 +298,7 @@ discard block |
|
|
block discarded – undo |
|
298
|
298
|
*/ |
|
299
|
299
|
protected function getRepeaters() |
|
300
|
300
|
{ |
|
301
|
|
- return collect($this->repeaters)->map(function ($repeater, $key) { |
|
|
301
|
+ return collect($this->repeaters)->map(function($repeater, $key) { |
|
302
|
302
|
$repeaterName = is_string($repeater) ? $repeater : $key; |
|
303
|
303
|
return [ |
|
304
|
304
|
'relation' => !empty($repeater['relation']) ? $repeater['relation'] : $this->inferRelationFromRepeaterName($repeaterName), |