Closed martijnc94 closed 5 years ago
I now use a workaround:
rendering the template like this: $this->content = \View::make(['template' => '{{$token}}'], ['token' => 'I am the child template'])->render();
and injecting that rendered template as a variable in a template file with contents: "{!! $content !!}"
@martijnc94 I think that is the work around for mailable. I think something similar was mentioned in this ticket https://github.com/TerrePorter/StringBladeCompiler/issues/21
@martijnc94 if you don't want to create extra blade file you can try this way.
$html = view(['template' => '{{$token}}'], ['token' => 'I am the child template']);
return $this->html($html->render());
@kyawkyawsoezhu That's the way I eventually figured out.
I am using the new version 3.6.0
When returning a view in a controller:
return view (['template' => '{{$token}}'], ['token' => 'I am the child template']);
Works fine, but when trying to create a Mailable:
return $this->view (['template' => '{{$token}}'], ['token' => 'I am the child template']);
Creates an empty mail. When I set a file as template, it works fine.