// Content variable to be used on view
$someContent = '<h1>Content test</h1>';
// A custom name for the file
$fileName = 'TestDoc';
return response()
->view('someview', ['content' => $someContent], 200)
->header('Content-Type', 'application/vnd.ms-word')
->header('Content-Disposition', 'attachment;Filename=' . $fileName. '.doc');
Created
September 24, 2018 18:33
-
-
Save maxcelos/b968177ee68976a630cba05bb6161b42 to your computer and use it in GitHub Desktop.
How to download a view as doc in Laravel
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment