Laravel.io
return $this->model->whereHas('mills', function($query) use ($gradeIds) {
            $query->whereHas('pulp', function ($query) use ($gradeIds) {
                $query->whereIn('grade_id', $gradeIds);
            });
        })->with(['mills' => function($query) {
            $query->with('pulp');
        }])->get();

Please note that all pasted data is publicly available.