mirror of
https://github.com/snipe/snipe-it.git
synced 2024-12-25 05:34:06 -08:00
added catch for no assets selected
This commit is contained in:
parent
b84eaaf61a
commit
382d849ee1
|
@ -334,10 +334,14 @@ class BulkAssetsController extends Controller
|
|||
}
|
||||
public function restore(Request $request) {
|
||||
$assetIds = $request->get('ids');
|
||||
foreach ($assetIds as $key => $assetId) {
|
||||
$asset = Asset::withTrashed()->find($assetId);
|
||||
$asset->restore();
|
||||
}
|
||||
return redirect()->route('hardware.index')->with('success', 'Assets Restored');
|
||||
if (empty($assetIds)) {
|
||||
return redirect()->route('hardware.index')->with('error', 'No Assets Selected');
|
||||
} else {
|
||||
foreach ($assetIds as $key => $assetId) {
|
||||
$asset = Asset::withTrashed()->find($assetId);
|
||||
$asset->restore();
|
||||
}
|
||||
return redirect()->route('hardware.index')->with('success', 'Assets Restored');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue