2016-05-10 22 views

回答

1

這應該做的伎倆:

$seminars = Seminar::whereDoesntHave('students', function($q) use ($studentId) { 
    $q->where('seminar_student.student_id', $studentId); 
})->get(); 
+0

感謝您的回答。這個代碼錯誤與'PHP錯誤:未定義的變量:studentId第1行' –

+1

@AlexanderLomia這是因爲你應該定義'$ studentId'。也**在線1 **?你把這些代碼放在哪裏? –

+0

的確如此。你需要在一個變量中有學生的ID。 –