app/DataTables/AbsencesDataTable.php
/**
     * Get query source of dataTable.
     *
     * @param \App\Models\Absence $model
     * @return \Illuminate\Database\Eloquent\Builder
     */
Get query source of dataTable.
Get query source of dataTable .
public function query(Absences $model)
    {
        return $model
            ->query()
            ->join('students', 'students.id', '=', 'absences.student_id')
            ->join('meetings', 'meetings.id', '=', 'absences.meeting_id')
            ->join('subjects', 'subjects.id', '=', 'meetings.subject_id')
            ->join('classrooms', 'classrooms.id', '=', 'subjects.classroom_id')
            ->join('grades', 'grades.id', '=', 'classrooms.grade_id')
            ->select(
                DB::raw('concat(students.firstname, " " , students.lastname) AS `student_name`'),
                'absences.status',
                'meetings.name AS meeting_name',
                'meetings.date',
                'meetings.start_at',
                'meetings.end_at',
                'classrooms.name AS class_name',
                'grades.name AS grade_name',
                'subjects.name AS subject_name',
            );
    }
public function query ( Absences $ model ) { return $ model -> query ( ) -> join ( 'students' , 'students.id' , '=' , 'absences.student_id' ) -> join ( 'meetings' , 'meetings.id' , '=' , 'absences.meeting_id' ) -> join ( 'subjects' , 'subjects.id' , '=' , 'meetings.subject_id' ) -> join ( 'classrooms' , 'classrooms.id' , '=' , 'subjects.classroom_id' ) -> join ( 'grades' , 'grades.id' , '=' , 'classrooms.grade_id' ) -> select ( DB :: raw ( 'concat(students.firstname, " " , students.lastname) AS `student_name`' ) , 'absences.status' , 'meetings.name AS meeting_name' , 'meetings.date' , 'meetings.start_at' , 'meetings.end_at' , 'classrooms.name AS class_name' , 'grades.name AS grade_name' , 'subjects.name AS subject_name' , ) ; }
Get query source of dataTable.
Get query source of dataTable .