Error Message:
[2016-01-19 14:47:08] local.ERROR: exception 'Symfony\Component\Debug\Exception\FatalErrorException' with message 'Call to undefined method Symfony\Component\HttpFoundation\BinaryFileResponse::header()' in C:\xampp\htdocs\development\app\filters.php:60
Stack trace:
#0 [internal function]: Illuminate\Exception\Handler->handleShutdown()
#1 {main} [] []
Code:
Controller:
public function download(){
$headers = array('Content-Type' => 'text/csv');
return Response::download('data_download.csv', 'data_download.csv', $headers)->setContentDisposition('inline');
}
Filter:
$response->header('Content-Type', 'text');
$response->header('Cache-Control', 'no-store, no-cache, must-revalidate, post-check=0, pre-check=0');
Maybe someone can help me with this.
You should use
$response->headers->set('Content-Type' , 'text');
$response->headers->set('Cache-Control', 'no-store, no-cache, must-revalidate, post-check=0, pre-check=0');
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community