Код: Выделить всё
$view = View::make('advertisement.advt_template.template_dr')->with('advtData', $advtData->first())->render();
$file_name = strtotime(date('Y-m-d H:i:s')) . '_advertisement_template.docx';
$headers = array(
"Content-type"=>"application/vnd.openxmlformats-officedocument.wordprocessingml.document",
"Content-Disposition"=>"attachment;Filename=$file_name"
);
return response()->make($view, 200, $headers);
- I am passing data to blade and then storing all information in a variable
- creating a file name for reference
- creating headers to be used when downloading file
- making the response with blade content variable and header information
Подробнее здесь: https://stackoverflow.com/questions/573 ... d-document
Мобильная версия