How to get Blade template view as a raw HTML string?
You can call render()
on the view
.
$html = view('users.edit', compact('user'))->render();
See the View
source code for more information.
This is the perfect solution of download/converting a blade file to HTML.
$view = view('welcome')->render();
header("Content-type: text/html");
header("Content-Disposition: attachment; filename=view.html");
return $view;