app/DataTables/SubjectsDataTable.php
/**
     * Get query source of dataTable.
     *
     * @param \App\Models\Subject $model
     * @return \Illuminate\Database\Eloquent\Builder
     */
Get query source of dataTable.
Get query source of dataTable .
public function query(Subjects $model)
    {
        return $model
            ->query()
            ->join('classrooms', 'subjects.classroom_id', '=', 'classrooms.id')
            ->join('grades', 'grades.id', '=', 'classrooms.grade_id')
            ->select('subjects.*', 'classrooms.name as class_name', 'grades.name as grade_name');
    }
public function query ( Subjects $ model ) { return $ model -> query ( ) -> join ( 'classrooms' , 'subjects.classroom_id' , '=' , 'classrooms.id' ) -> join ( 'grades' , 'grades.id' , '=' , 'classrooms.grade_id' ) -> select ( 'subjects.*' , 'classrooms.name as class_name' , 'grades.name as grade_name' ) ; }
Get query source of dataTable.
Get query source of dataTable .