Found a better place for the where condition
This commit is contained in:
@@ -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%"]);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user