Created
April 14, 2015 07:54
-
-
Save gravitano/edc6579582cc7988e7e6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if ( ! function_exists('xls')) | |
{ | |
/** | |
* XLS Response. | |
* | |
* @param string $filename | |
* @param string $view | |
* @param array $data | |
* @param integer $status | |
* @return \Response | |
*/ | |
function xls($filename, $view, $data = [], $status = 200) | |
{ | |
$filename = $filename . date('YmdHis').'.xls'; | |
return response()->view($view, $data, $status, [ | |
"Pragma" => " public", | |
"Expires" => " 0", | |
"Cache-Control" => " must-revalidate, post-check=0, pre-check=0", | |
"Content-Type" => " application/force-download", | |
"Content-Type" => " application/octet-stream", | |
"Content-Type" => " application/download", | |
"Content-Disposition" => " attachment;filename={$filename}", | |
"Content-Transfer-Encoding" => " binary ", | |
]); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment