Merge pull request #16788 from grokability/better_handle_arrays_for_model_ids

Better handle model_id arrays passed to the API
This commit is contained in:
snipe
2025-04-22 16:33:47 +01:00
committed by GitHub
@@ -298,9 +298,15 @@ class AssetsController extends Controller
if ($request->input('requestable') == 'true') {
$assets->where('assets.requestable', '=', '1');
}
if ($request->filled('model_id')) {
$assets->InModelList([$request->input('model_id')]);
// If model_id is already an array, just use it as-is
if (is_array($request->input('model_id'))) {
$assets->InModelList($request->input('model_id'));
} else {
// Otherwise, turn it into an array
$assets->InModelList([$request->input('model_id')]);
}
}
if ($request->filled('category_id')) {