$lessonIDs = DB::table($personType."_has_lesson")->where("id",$userID)->pluck("lesson_id"); $lessons = DB::table("lesson")->whereIn("lesson_id",$lessonIDs)->get();