Skip to content

Instantly share code, notes, and snippets.

@thanhtutoo
Created June 9, 2018 18:37
Show Gist options
  • Save thanhtutoo/d3ad0893234bf68aceefc56137d2c1f2 to your computer and use it in GitHub Desktop.
Save thanhtutoo/d3ad0893234bf68aceefc56137d2c1f2 to your computer and use it in GitHub Desktop.
please replace downloadExcel function with the following line of codes.
//for download excel
public function downloadExcel($type)
{
ini_set('max_execution_time', 3000);
set_time_limit ( 3000 );
$user = new Jobseeker;
$data = $user->query();
try{
$filedate = str_replace(' ', '_', Carbon::now());
return Excel::create('UserList'.$filedate, function($excel) use($data){
$data->chunk(10000, function ($users) use($excel) {
$collection = $this->transformCollection($users);
$excel->sheet('OrgSubUserList', function($sheet) use($collection){
$sheet->fromModel($collection, null, 'A1', true);
});
});
})->export('xlsx');
}
catch(Exception $e)
{
return false;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment