public function exportToExcel() { Excel::create(Carbon::now() . ' - semua pendaftar', function ($excel) { $excel->setTitle('Semua Pendaftar'); $excel->sheet('First sheet', function ($sheet) { $titles = array('No. Registrasi', 'Nama Lengkap'); $registrants = Registrant::all(); $sheet->fromModel($registrants, null, 'A1', true); }); })->download('xlsx'); }