You didn't show how you populated the $products variable so it's going to be hard to give you an answer.
Jan 31, 2017
5
Level 6
get View as a string
Hello! In my application I want to gave to users possibility to create some documents (invoices, specifications, other) by themselves. It's easy, cause they all knows html. Templates of documents stored in database. In templates we use Blade directives to list products, show properties of product, etc.
It works well, when view returns to the browser. But I want also get it as a string and save it
But when I use code like this
$compiled = return view('dope')->with('products', $products);
I get object, but not string. What should I use?
(Blade::compileString not work at all)
Level 50
Hi @deromanenko, try this..
$compiled = view('dope')->with('products', $products)->render();
4 likes
Please or to participate in this conversation.