Found a better place for the where condition

This commit is contained in:
Ivan Nieto Vivanco 2022-08-10 19:13:28 -05:00
parent c1074000f9
commit a7de97f060

View file

@ -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%"]);
}
});
}