Merge pull request #15122 from snipe/fixes/15121_bulk_delete_and_restore

Fixed #15121 - bulk delete restore logging
This commit is contained in:
snipe 2024-07-19 20:03:32 +01:00 committed by GitHub
commit 9ea38fbb3a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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'));