I'm trying to do this query in Laravel.
SELECT DISTINCT curriculum.Course_Code, transcript.Course_Grade, transcript.Course_Comp, transcript.CWID
FROM curriculum
LEFT JOIN transcript
ON curriculum.Course_Code = transcript.Course_Code AND transcript.CWID = "C38475920";
Except I'm no longer using the static CWID ->"C38475920". This is what I have:
public function getProgress($id){
return DB::table('curriculum')
->select('curriculum.Course_Code','transcript.Course_Comp', 'transcript.Term_Completed', 'transcript.Course_Grade')
->distinct('curriculum.Course_Code')
->leftJoin('transcript', 'curriculum.Course_Code','=','transcript.Course_Code')
->on('CWID', '=', $id)
->get();
}
The function gives this error BadMethodCallException: Call to undefined method Illuminate\Database\Query\Builder::on() in file
Do I have to add something to my model to use ON?