This is my working variant for Laravel 7
DB::table('user') ->select('id','name') ->whereNotIn('id', DB::table('curses')->where('id_user', $id)->pluck('id_user')->toArray()) ->get();
This is my working variant for Laravel 7
DB::table('user') ->select('id','name') ->whereNotIn('id', DB::table('curses')->where('id_user', $id)->pluck('id_user')->toArray()) ->get();