Skip to content

Commit

Permalink
Fixed #15121 - bulk delete restore logging
Browse files Browse the repository at this point in the history
Signed-off-by: snipe <[email protected]>
  • Loading branch information
snipe committed Jul 19, 2024
1 parent 8b05ef6 commit 94619e3
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions app/Http/Controllers/Assets/BulkAssetsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,9 @@ public function edit(Request $request) : View | RedirectResponse
// This handles all of the pivot sorting below (versus the assets.* fields in the allowed_columns array)
$column_sort = in_array($sort_override, $allowed_columns) ? $sort_override : 'assets.id';

$assets = Asset::with('assignedTo', 'location', 'model')->whereIn('assets.id', $asset_ids);
$assets = Asset::with('assignedTo', 'location', 'model')
->whereIn('assets.id', $asset_ids)
->withTrashed();

$assets = $assets->get();

Expand Down Expand Up @@ -483,12 +485,7 @@ public function destroy(Request $request) : RedirectResponse
if ($request->filled('ids')) {
$assets = Asset::find($request->get('ids'));
foreach ($assets as $asset) {
$update_array['deleted_at'] = date('Y-m-d H:i:s');
$update_array['assigned_to'] = null;

DB::table('assets')
->where('id', $asset->id)
->update($update_array);
$asset->delete();
} // endforeach

return redirect($bulk_back_url)->with('success', trans('admin/hardware/message.delete.success'));
Expand Down

0 comments on commit 94619e3

Please sign in to comment.