I have a query for multiple searches, the problem is with one of them, I get a correct result from it, but in combination with the rest, I get the wrong response for the rest of the fields.
//I get the correct result for first if, but the second one returns a wrong response.
if ($request->has('search_fullname') && !is_null($request->search_fullname)) {
$query->where('full_name', 'ILIKE', $request->search_fullname . '%')
->orWhere('full_name', 'ILIKE', '% ' . $request->search_fullname . '%');
}
if ($request->has('search_gender') && !is_null($request->search_gender)) {
$query->where('gender', '=', $request->search_gender);
} //like this if I have many more, the problem is strict from the first one