vinubangs's avatar

how to convert blade file into html and save into folder

I am using laravel lumen for making an API. I need to convert blade file into html and save that file into image.

I tried, but not working.

my controller is:

public function viewcards()
{
$html = View::make('template1');
$html = $html->render();
$html = html_entity_decode($html);
return response()->json(['CardSave' => $html, 'message' => 'Success'], 201);
}

But in response of postman:

{
"CardSave": "<!DOCTYPE html>\r\n<html>\r\n    <head>\r\n        <title>Template One</title>\r\n        <link href=\"http://localhost/ark_newtech_digbiz/digbizcardapi/public/css/style1.css\" rel=\"stylesheet\" />\r\n        <link href=\"http://localhost/ark_newtech_digbiz/digbizcardapi/public/css/font-awesome.min.css\" rel=\"stylesheet\" />
}

why showing \r\n and not taking < in response. And how to save it into html?

I am stuck from 2 days. Please help anyone.

0 likes
1 reply
fylzero's avatar

@vinubangs Not sure I understand your issue. Have you tried using htmlentities() then using html_entity_decode() on the other side of the process when you are parsing? The way you are exporting won't transport via json because of quotations I don't think.

24 likes

Please or to participate in this conversation.