A free open source IT asset/license management system
Found a better place for the where condition
Ivan Nieto Vivancoa7de97f06062
diff --git a/app/Models/Traits/Searchable.php b/app/Models/Traits/Searchable.phpindex 3c493b4a81..ffe7e05a1d 100644--- a/app/Models/Traits/Searchable.php+++ b/app/Models/Traits/Searchable.php@@ -161,11 +161,12 @@ trait Searchable}$query->orWhere($table.'.'.$column, 'LIKE', '%'.$term.'%');- if($table == 'users'){- $query->orWhereRaw('CONCAT(users.first_name ," ", users.last_name) LIKE ?', ["%$term%"]);- }}}+ // I put this here because I only want to add the concat one time in the end of the user relation search+ if($relation == 'user') {+ $query->orWhereRaw('CONCAT (users.first_name, " ", users.last_name) LIKE ?', ["%$term%"]);+ }});}