Tuesday, March 7, 2017

Laravel Join query with LIKE

$toReturn['exams'] = exams_list::where('examAcYear',$this->panelInit->selectAcYear)
    ->join('classes', 'exams_list.examClasses', '=', 'classes.id')
    ->where('classes.classTeacher', 'LIKE', '%'.$this->data['users']->id.'%')
    ->select('classes.*','exams_list.exam_name')
    ->get()
    ->toArray(); 

Is this query correct? I have to join 2 tables classes and exams_list, but am not getting any values.



via Cliffs

Advertisement