Skip to content

Commit 354941c

Browse files
committed
Skip attempt to assign non-existing image
1 parent 8c3cf88 commit 354941c

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

src/Http/Controllers/PageBlockController.php

+12-6
Original file line numberDiff line numberDiff line change
@@ -59,13 +59,19 @@ public function update(Request $request, $id)
5959
foreach ($template->fields as $row) {
6060
$existingData = $block->data;
6161

62-
if ($row->partial === 'voyager::formfields.image' && is_null($request->input($row->field))) {
63-
$data[$row->field] = $existingData->{$row->field};
64-
65-
continue;
62+
if ($row->partial === 'voyager::formfields.image') {
63+
if (is_null($request->file($row->field))) {
64+
if (isset($existingData->{$row->field})) {
65+
$data[$row->field] = $existingData->{$row->field};
66+
}
67+
68+
continue;
69+
}
70+
71+
$data[$row->field] = $request->file($row->field);
72+
} else {
73+
$data[$row->field] = $request->input($row->field);
6674
}
67-
68-
$data[$row->field] = $request->input($row->field);
6975
}
7076

7177
// Just.Do.It! (Nike, TM)

0 commit comments

Comments
 (0)