fare riferimento a questo
$courseId = 1;
$data = DB::table('student')->whereIn('id',function($query) use (courseId){
$query->select('student_id')
->from('student_course')->where('course_id', '=',$courseId);
})->get();
fare riferimento a questo
$courseId = 1;
$data = DB::table('student')->whereIn('id',function($query) use (courseId){
$query->select('student_id')
->from('student_course')->where('course_id', '=',$courseId);
})->get();