Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[5.7] Mailable render() respects Mailable@locale #25990

Merged
merged 1 commit into from
Oct 8, 2018

Conversation

derekmd
Copy link
Contributor

@derekmd derekmd commented Oct 7, 2018

laravel/ideas#1318

When testing mailables in the browser or calling Mailable@render() in production (e.g., to store the HTML string in the database), this will render in Mailable@locale when it is filled.

Testing example:

$mail = new App\Mail\OrderConfirmation(App\Order::first());
$translatedHtml = $mail->locale('es')->render();

Production example:

$mail = new OrderConfirmation($order);
Mail::to($user)->queue($mail);

// this would be in $user->preferredLocale()
$translatedHtml = $mail->render();

In production, this allows:

(new Mailable)->locale('es')->render()
@taylorotwell taylorotwell merged commit d1be6e4 into laravel:5.7 Oct 8, 2018
@derekmd derekmd deleted the mailable-render-in-locale branch October 8, 2018 14:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants