Skip to content

Commit

Permalink
Merge branch '1.4' into fix-scope-not-working-with-withtrashed
Browse files Browse the repository at this point in the history
  • Loading branch information
emptynick authored Jan 28, 2021
2 parents e8ce0a3 + 1732bee commit 5c8f19b
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/Http/Controllers/VoyagerBaseController.php
Original file line number Diff line number Diff line change
Expand Up @@ -332,8 +332,19 @@ public function update(Request $request, $id)

// Validate fields with ajax
$val = $this->validateBread($request->all(), $dataType->editRows, $dataType->name, $id)->validate();

// Get fields with images to remove before updating and make a copy of $data
$to_remove = $dataType->editRows->where('type', 'image')
->filter(function ($item, $key) use ($request) {
return $request->hasFile($item->field);
});
$original_data = clone($data);

$this->insertUpdateData($request, $slug, $dataType->editRows, $data);

// Delete Images
$this->deleteBreadImages($original_data, $to_remove);

event(new BreadDataUpdated($dataType, $data));

if (auth()->user()->can('browse', app($dataType->model_name))) {
Expand Down

0 comments on commit 5c8f19b

Please sign in to comment.