mirror of
https://github.com/snipe/snipe-it.git
synced 2025-01-23 19:59:18 -08:00
Redirect if no assets are returned from query
This commit is contained in:
parent
806671df7c
commit
f270f30728
|
@ -14,6 +14,7 @@ use App\View\Label;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Illuminate\Support\Facades\Auth;
|
use Illuminate\Support\Facades\Auth;
|
||||||
use Illuminate\Support\Facades\DB;
|
use Illuminate\Support\Facades\DB;
|
||||||
|
use Illuminate\Support\Facades\Log;
|
||||||
use Illuminate\Support\Facades\Session;
|
use Illuminate\Support\Facades\Session;
|
||||||
use App\Http\Requests\AssetCheckoutRequest;
|
use App\Http\Requests\AssetCheckoutRequest;
|
||||||
use App\Models\CustomField;
|
use App\Models\CustomField;
|
||||||
|
@ -95,6 +96,11 @@ class BulkAssetsController extends Controller
|
||||||
|
|
||||||
$assets = $assets->get();
|
$assets = $assets->get();
|
||||||
|
|
||||||
|
if ($assets->isEmpty()) {
|
||||||
|
Log::debug('No assets were found for the provided IDs', ['ids' => $asset_ids]);
|
||||||
|
return redirect()->back()->with('error', trans('admin/hardware/message.update.assets_do_not_exist_or_are_invalid'));
|
||||||
|
}
|
||||||
|
|
||||||
$models = $assets->unique('model_id');
|
$models = $assets->unique('model_id');
|
||||||
$modelNames = [];
|
$modelNames = [];
|
||||||
foreach($models as $model) {
|
foreach($models as $model) {
|
||||||
|
|
|
@ -19,6 +19,7 @@ return [
|
||||||
'success' => 'Asset updated successfully.',
|
'success' => 'Asset updated successfully.',
|
||||||
'nothing_updated' => 'No fields were selected, so nothing was updated.',
|
'nothing_updated' => 'No fields were selected, so nothing was updated.',
|
||||||
'no_assets_selected' => 'No assets were selected, so nothing was updated.',
|
'no_assets_selected' => 'No assets were selected, so nothing was updated.',
|
||||||
|
'assets_do_not_exist_or_are_invalid' => 'Selected assets cannot be updated.',
|
||||||
],
|
],
|
||||||
|
|
||||||
'restore' => [
|
'restore' => [
|
||||||
|
|
Loading…
Reference in a new issue