fix: ensure email body is fresh from template during queue execution
This commit is contained in:
@@ -46,9 +46,14 @@ class Mail extends Mailable
|
||||
*/
|
||||
public function content(): Content
|
||||
{
|
||||
// Always get fresh body from the template to handle queue serialization properly
|
||||
$viewData = $this->data;
|
||||
$viewData['body'] = $this->emailTemplate->body ?? '';
|
||||
$viewData['data'] = $viewData; // Ensure 'data' key exists for BladeCompiler::render
|
||||
|
||||
return new Content(
|
||||
html: 'components.mail.base',
|
||||
with: $this->data,
|
||||
with: $viewData,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
<x-mail.layout>
|
||||
{!! Illuminate\View\Compilers\BladeCompiler::render($body, $data) !!}
|
||||
@if(!empty($body))
|
||||
{!! Illuminate\View\Compilers\BladeCompiler::render($body, $data ?? []) !!}
|
||||
@endif
|
||||
</x-mail.layout>
|
||||
|
||||
Reference in New Issue
Block a user