From b607a59875711aaecbced6732912b66232dac1f1 Mon Sep 17 00:00:00 2001 From: Ivan Nieto Vivanco Date: Wed, 16 Aug 2023 15:04:17 -0600 Subject: [PATCH] Add query to search default locations in advanced search --- app/Models/Asset.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/Models/Asset.php b/app/Models/Asset.php index 95e1c3a166..6792cf2859 100644 --- a/app/Models/Asset.php +++ b/app/Models/Asset.php @@ -1433,6 +1433,12 @@ class Asset extends Depreciable }); } + if ($fieldname == 'rtd_location') { + $query->whereHas('defaultLoc', function ($query) use ($search_val) { + $query->where('locations.name', 'LIKE', '%'.$search_val.'%'); + }); + } + if ($fieldname =='assigned_to') { $query->whereHasMorph('assignedTo', [User::class], function ($query) use ($search_val) { $query->where(function ($query) use ($search_val) {