mirror of
https://github.com/grokability/snipe-it.git
synced 2026-03-12 17:52:00 +08:00
Better handle arrays in API rerquests for model_id
Signed-off-by: snipe <snipe@snipe.net>
This commit is contained in:
@@ -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')) {
|
||||
|
||||
Reference in New Issue
Block a user