title: select all columns which are not in another table laravel 5.5
body: <p>I have two tables - the first one is called 'users' and the second one is called 'buy_courses'.</p>
  
  <p><a href="https://i.stack.imgur.com/F9d69.png" rel="noreferrer"><img src="https://i.stack.imgur.com/F9d69.png" alt="users table"></a></p>
  
  <p><a href="https://i.stack.imgur.com/MrFfq.png" rel="noreferrer"><img src="https://i.stack.imgur.com/MrFfq.png" alt="enter image description here"></a></p>
  
  <p>I am trying to select all users those user_name is not in buy_courses. I tried something like -</p>
  
  <pre><code>$users = DB::table('users')
                  -&gt;rightjoin('buy_courses', 'users.user_name', '=', 'buy_courses.user_name')
                  -&gt;get();
  </code></pre>
  
  <p>It returns all users, whose user_name is in 'buy_courses', when I am using '&lt;>', then I'm getting all users. What should be the right query?</p>