/** * Transmits the proper headers to cause a download to occur and to identify the file properly * @return nothing */ function headers() { header("Content-Type: application/force-download"); header("Content-Type: application/octet-stream"); header("Content-Type: application/download"); header("Content-Disposition: attachment;filename=" . ExcelFile::filename($this->title) . ".xls "); header("Content-Transfer-Encoding: binary "); }
public function getExport() { \User::onlyHas('newsletter-view'); $emails = NewsletterModel::all(); $matrix = [['Email', 'Status', 'Date']]; foreach ($emails as $email) { $matrix[] = [$email->email, $email->enabled ? 'activ' : 'inactiv', $email->subscribe_date]; } $excel = new \ExcelFile('NewsLetterExport.xls'); $excel->convert($matrix); }