}
public function exportExcel() {
- $errorlinks = FluidbookAuditLink::where('error_code','!=','')->get()->toArray();
- $redirectionlinks = FluidbookAuditLink::where('redirection_code','!=','')->get()->toArray();
+ $errorlinks = FluidbookAuditLink::where('error_code','!=','')->get();
+ $redirectionlinks = FluidbookAuditLink::where('redirection_code','!=','')->get();
$links = [
- "erreurs" => $errorlinks,
- "avertissements" => $redirectionlinks
+ "erreurs" => $errorlinks->makeHidden(['updated_at', 'created_at', 'deleted_at'])->toArray(),
+ "avertissements" => $redirectionlinks->makeHidden(['updated_at', 'created_at', 'deleted_at'])->toArray()
];
- $errorKeys = array_keys($errorlinks[0]);
+ $errorKeys = array_keys($links['erreurs'][0]);
$excel = new Spreadsheet();
$writer = new Xlsx($excel);
$writer->save($tmpfile);
- return response()->download($tmpfile, 'erreurs.xlsx')->deleteFileAfterSend();
+ $filename = "hemsley_fraser_audit_".date('Ymd').".xlsx";
+
+ return response()->download($tmpfile, $filename)->deleteFileAfterSend();
}
}