Skip to content

Commit

Permalink
Merge pull request #2 from snipe/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
nuraeil authored Nov 4, 2021
2 parents 63b3048 + 98de852 commit 3f2749d
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions app/Models/Asset.php
Original file line number Diff line number Diff line change
Expand Up @@ -1357,8 +1357,8 @@ public function scopeByFilter($query, $filter)
});
}

if ($fieldname == 'checkedout_to') {
$query->whereHas('assigneduser', function ($query) use ($search_val) {
if ($fieldname =='assigned_to') {
$query->whereHasMorph('assignedTo', [User::class], function ($query) use ($search_val) {
$query->where(function ($query) use ($search_val) {
$query->where('users.first_name', 'LIKE', '%'.$search_val.'%')
->orWhere('users.last_name', 'LIKE', '%'.$search_val.'%');
Expand Down Expand Up @@ -1421,7 +1421,7 @@ public function scopeByFilter($query, $filter)
});
});
}
}


/**
* THIS CLUNKY BIT IS VERY IMPORTANT
Expand All @@ -1447,11 +1447,11 @@ public function scopeByFilter($query, $filter)
*/

if (($fieldname!='category') && ($fieldname!='model_number') && ($fieldname!='rtd_location') && ($fieldname!='location') && ($fieldname!='supplier')
&& ($fieldname!='status_label') && ($fieldname!='model') && ($fieldname!='company') && ($fieldname!='manufacturer')) {
&& ($fieldname!='status_label') && ($fieldname!='assigned_to') && ($fieldname!='model') && ($fieldname!='company') && ($fieldname!='manufacturer')) {
$query->where('assets.'.$fieldname, 'LIKE', '%' . $search_val . '%');
}


}


});
Expand Down

0 comments on commit 3f2749d

Please sign in to comment.