Skip to content

Commit

Permalink
Add query to search default locations in advanced search
Browse files Browse the repository at this point in the history
  • Loading branch information
inietov committed Aug 16, 2023
1 parent b81c682 commit b607a59
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions app/Models/Asset.php
Original file line number Diff line number Diff line change
Expand Up @@ -1433,6 +1433,12 @@ public function scopeByFilter($query, $filter)
});
}

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) {
Expand Down

0 comments on commit b607a59

Please sign in to comment.