$qualifications = DB::table('qualifications')
->join('engineers', 'qualifications.engineer_id', '=', 'engineers.id')
->join('courses', 'qualifications.course_id', '=', 'courses.id')
->select('qualifications.*', 'engineers.name as engineers_name', 'courses.course_name')
->orderBy('engineers_name', 'asc')
->paginate(15);
This query will join the engineers table and the courses table to the qualifications table and will make the engineers.name column available as engineers_name in the view. Remember relationships on this query (qualifications) will not be available in the view.
Example
$qualification->engineer
will not work.
Comments