app/DataTables/TeachersDataTable.php
/**
     * Get query source of dataTable.
     *
     * @param \App\Models\Teacher $model
     * @return \Illuminate\Database\Eloquent\Builder
     */
Get query source of dataTable.
Get query source of dataTable .
public function query(Teachers $model)
    {
        return $model
            ->join('users', 'teachers.user_id', '=', 'users.id')
            ->select(
                'teachers.id',
                'teachers.firstname',
                'teachers.lastname',
                'teachers.teacher_id',
                'teachers.image',
                'teachers.degree',
                'teachers.status',
                'teachers.reason',
                'teachers.phone',
                'teachers.address',
                'users.username AS username',
                'users.email AS email'
            );
    }
public function query ( Teachers $ model ) { return $ model -> join ( 'users' , 'teachers.user_id' , '=' , 'users.id' ) -> select ( 'teachers.id' , 'teachers.firstname' , 'teachers.lastname' , 'teachers.teacher_id' , 'teachers.image' , 'teachers.degree' , 'teachers.status' , 'teachers.reason' , 'teachers.phone' , 'teachers.address' , 'users.username AS username' , 'users.email AS email' ) ; }
Get query source of dataTable.
Get query source of dataTable .