From 9687bcb41c163880237790f4e62af1aa21c30034 Mon Sep 17 00:00:00 2001 From: snipe Date: Fri, 20 Aug 2021 17:30:35 -0700 Subject: [PATCH] Fixed issue where consumables model number was not searchable Signed-off-by: snipe --- app/Http/Controllers/Api/ConsumablesController.php | 4 ++++ app/Models/Consumable.php | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/app/Http/Controllers/Api/ConsumablesController.php b/app/Http/Controllers/Api/ConsumablesController.php index 44fe602159..f4c9da3df8 100644 --- a/app/Http/Controllers/Api/ConsumablesController.php +++ b/app/Http/Controllers/Api/ConsumablesController.php @@ -42,6 +42,10 @@ class ConsumablesController extends Controller $consumables->where('category_id','=',$request->input('category_id')); } + if ($request->filled('model_number')) { + $consumables->where('model_number','=',$request->input('model_number')); + } + if ($request->filled('manufacturer_id')) { $consumables->where('manufacturer_id','=',$request->input('manufacturer_id')); } diff --git a/app/Models/Consumable.php b/app/Models/Consumable.php index 14de8c6ebb..65214961fc 100644 --- a/app/Models/Consumable.php +++ b/app/Models/Consumable.php @@ -78,7 +78,7 @@ class Consumable extends SnipeModel * * @var array */ - protected $searchableAttributes = ['name', 'order_number', 'purchase_cost', 'purchase_date', 'item_no']; + protected $searchableAttributes = ['name', 'order_number', 'purchase_cost', 'purchase_date', 'item_no', 'model_number']; /** * The relations and their attributes that should be included when searching the model.