title: How can use 'WHERE' with 'WhereNotIn' in laravel
body: <p>I want to use <code>Where</code> to select <code>id</code> in some table which not in another table by <code>WhereNotIn</code></p>
  
  <pre><code> public function showbydate($id)
  {
  
      $bookappoitm=DB::table('times')
           -&gt;where('times.Dates_id','=',1)
           -&gt;whereNOTIn('times.id',function($query){
                 $query-&gt;select('times_id')-&gt;from('bookappoitments')
                 -&gt;where('users_id',Auth::user()-&gt;id);
           })
           -&gt;get();
  
       return view('admin.Booking.addappointment', compact('bookappoitm'));
  }
  </code></pre>
  
  <p>Ho can I use <code>$id</code> instead of number one '1'</p>