public function pdf() { $strFileName = "HTMLControl" . '_' . date_format(\Carbon\Carbon::now(), 'Ymd'); \Excel::create($strFileName, function ($excel) { $excel->sheet("HTMLControl", function ($sheet) { $HTMLControls = $this->_searchQuery(HTMLControl::where('deleted_at', '=', null))->get(); $sheet->fromArray($HTMLControls); }); })->download('pdf'); }