I couldnt find what i need anywhere.
In my controller i have a function called to download a .xls file after my table is filtered. i get the variable with 'session::get'
this is the dd($data); enter image description here
the download button works fine. I just cant get each field to fill a different cell, like ID - A1, Name - B1... and bellow the respective fields.
this is my controller function:
public function downloadExcel($type) {
$data1 = array();
$data = Session::get('data');
//dd($data);
return Excel::create('teste', function($excel) use ($data) {
$excel->sheet('mySheet', function($sheet) use ($data)
{
$sheet->fromArray($data);
});
})->download($type);
}
via Ricardo Pinto