How to Render a Laravel View as a String

Sometimes you may want to render a view in Laravel as a string and store it inside a variable. You can easily perform this task by using the render() method in Laravel.

$html = View::make('profile',['name' => 'Harshal'])->render();

Must Read : How to Create a Custom Validation Rule in Laravel


Leave a Comment.