mardi 2 avril 2019

How can use 'WHERE' with 'WhereNotIn' in laravel

I want to use 'Where' to select "id" in some table which not in another table by WhereNotIn

 public function showbydate($id)
{

    $bookappoitm=DB::table('times')

         ->where('times.Dates_id','=',1)

         ->whereNOTIn('times.id',function($query){

           $query->select('times_id')->from('bookappoitments')
          ->where('users_id',Auth::user()->id);

     })

   ->get();

     return view('admin.Booking.addappointment', compact('bookappoitm'));
}

Ho can I use $id instead of number one '1'



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire