title: How to validate the equality of two columns in a where of two tables in Laravel
body: <p>I have two tables with the following structure</p>
  
  <pre><code>Table 1                                  Table2
  
  table_id|table_name               table_id2| table_name2
    1     | sale                         2   | sale  
    2     | sale                         1   | note
    1     | note 
    3     | sale
    2     | note
  </code></pre>
  
  <p>I want to get all the records from the first table where table_id and table_name are not in table2 (id, table)</p>
  
  <p>Expected result</p>
  
  <pre><code> 1 | sale   
   3 | sale   
   2 | note   
  </code></pre>
  
  <p>Something like this occurred to me but I don't get the expected results</p>
  
  <pre><code>$table1-&gt;where(function ($query)  {
          $query-&gt;whereNotIn('table_id',$table2-&gt;pluck('table_id2'));
     });
  </code></pre>