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

Projects
None yet
2 participants
@derekmd
Contributor

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();
Mailable render() respects locale
In production, this allows:

(new Mailable)->locale('es')->render()

@taylorotwell taylorotwell merged commit d1be6e4 into laravel:5.7 Oct 8, 2018

2 checks passed

continuous-integration/styleci/pr The analysis has passed
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

@derekmd derekmd deleted the derekmd:mailable-render-in-locale branch Oct 8, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment