From 94619e3284af98b175e68f3fbba9af055b366d32 Mon Sep 17 00:00:00 2001 From: snipe Date: Fri, 19 Jul 2024 19:56:58 +0100 Subject: [PATCH] Fixed #15121 - bulk delete restore logging Signed-off-by: snipe --- app/Http/Controllers/Assets/BulkAssetsController.php | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/app/Http/Controllers/Assets/BulkAssetsController.php b/app/Http/Controllers/Assets/BulkAssetsController.php index 13f9c4fc92..287bc0611b 100644 --- a/app/Http/Controllers/Assets/BulkAssetsController.php +++ b/app/Http/Controllers/Assets/BulkAssetsController.php @@ -92,7 +92,9 @@ class BulkAssetsController extends Controller // 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(); @@ -483,12 +485,7 @@ class BulkAssetsController extends Controller 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'));