I have two tables - the first one is called \'users\' and the second one is called \'buy_courses\'.
I am trying to select all users those user_name
just replace = with != , use function join
=
!=
$users = DB::table('users') ->join( 'buy_courses', function ($join) {$join->on('users.user_name', '!=', 'buy_courses.user_name');} ) ->get();