Fix ID array

Signed-off-by: snipe <snipe@snipe.net>
This commit is contained in:
snipe 2021-10-04 17:18:07 -07:00
parent caad5be957
commit 52ea172e5d
2 changed files with 6 additions and 3 deletions

View file

@ -32,7 +32,8 @@ class BulkAssetsController extends Controller
return redirect()->back()->with('error', 'No assets selected'); return redirect()->back()->with('error', 'No assets selected');
} }
$asset_ids = array_keys($request->input('ids'));
$asset_ids = array_values(array_unique($request->input('ids')));
if ($request->filled('bulk_actions')) { if ($request->filled('bulk_actions')) {
switch($request->input('bulk_actions')) { switch($request->input('bulk_actions')) {
@ -50,7 +51,7 @@ class BulkAssetsController extends Controller
return view('hardware/bulk-delete')->with('assets', $assets); return view('hardware/bulk-delete')->with('assets', $assets);
case 'edit': case 'edit':
return view('hardware/bulk') return view('hardware/bulk')
->with('assets', request('ids')) ->with('assets', $asset_ids)
->with('statuslabel_list', Helper::statusLabelList()); ->with('statuslabel_list', Helper::statusLabelList());
} }
} }
@ -90,6 +91,8 @@ class BulkAssetsController extends Controller
|| ($request->filled('model_id')) || ($request->filled('model_id'))
) { ) {
foreach ($assets as $assetId) { foreach ($assets as $assetId) {
\Log::error($assetId);
$this->update_array = []; $this->update_array = [];
$this->conditionallyAddItem('purchase_date') $this->conditionallyAddItem('purchase_date')

View file

@ -149,7 +149,7 @@
</div> </div>
@foreach ($assets as $key => $value) @foreach ($assets as $key => $value)
<input type="hidden" name="ids[{{ $key }}]" value="1"> <input type="hidden" name="ids[{{ $value }}]" value="1">
@endforeach @endforeach
</div> <!--/.box-body--> </div> <!--/.box-body-->