I am new to Laravel. I want to filter users from a table.
1) First table 'users' Users table
2) Second table 'requests' Requests table
3) My controller
public function search()
{
$my_id= Auth::User()->id;
$my_gender= Auth::User()->gender;
$users = DB::table('users')
->join('personal_info', 'users.id', '=', 'personal_info.user_id')
->join('user_about', 'users.id', '=', 'user_about.user_id');
->join('requests', 'users.id', '=', 'requests.request_to_id');
$users = $users ->whereNotIn('users.id', [$my_id]);
$users = $users ->whereNotIn('users.gender', [$my_gender]);
$users = $users ->whereNotIn('requests.request_to_id', ['users.id']);
$users = $users ->paginate(7);
return view('search',compact('users'));
}
4) Users is my primary table , it is combined with two other table and also with requests table , I want filter users (users.id) who are present in (requests.request_to_id) . And I get blank screen nothing get.