From f64c02ce12c0c6ea94932f078199cad1c5cda62d Mon Sep 17 00:00:00 2001 From: snipe Date: Tue, 10 Oct 2017 23:12:16 -0700 Subject: [PATCH] Fix for ambiguous query on models --- app/Models/AssetModel.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/Models/AssetModel.php b/app/Models/AssetModel.php index 52884c0bd3..e353a149aa 100755 --- a/app/Models/AssetModel.php +++ b/app/Models/AssetModel.php @@ -153,17 +153,17 @@ class AssetModel extends SnipeModel ->orWhere('model_number', 'LIKE', "%$search%") ->orWhere(function ($query) use ($search) { $query->whereHas('depreciation', function ($query) use ($search) { - $query->where('name', 'LIKE', '%'.$search.'%'); + $query->where('depreciations.name', 'LIKE', '%'.$search.'%'); }); }) ->orWhere(function ($query) use ($search) { $query->whereHas('category', function ($query) use ($search) { - $query->where('name', 'LIKE', '%'.$search.'%'); + $query->where('categories.name', 'LIKE', '%'.$search.'%'); }); }) ->orWhere(function ($query) use ($search) { $query->whereHas('manufacturer', function ($query) use ($search) { - $query->where('name', 'LIKE', '%'.$search.'%'); + $query->where('manufacturers.name', 'LIKE', '%'.$search.'%'); }); });