How to store html of view file into variable in laravel 5.4?

Viewed 6554

I just tried below code and it returns nothing.

$view = \View::make('users.index', $data)->render();
1 Answers

Try casting your view to string

$view = (string)View::make('users.index',$data);

to display the view you simply do:

echo $view

Related