What i need is export data table details into excel file.so that here is the controller which i developed.
public function export(){
$items = registerdetails::all();
Excel::create('Export Data', function($excel) use($item){
$excel->sheet('Sheet 1', function($sheet) use($item){
$sheet->fromArray($item);
});
})->export('xlsx');
}
Relevant route for that is.
Route::get('ExportData', 'UserRegisterController@export');
i don't create view for this but i called this route via a button called Download All Trainees in index page.
<a class="btn btn-success " href="{{URL::to('ExportData')}}">Dowanload All Trainees</a>
Finally here is the error i`m getting now.
Can anyone help me solve this please.