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] Correct Mail set locale code snippet #4875

Merged
merged 1 commit into from
Jan 1, 2019
Merged

[5.7] Correct Mail set locale code snippet #4875

merged 1 commit into from
Jan 1, 2019

Conversation

derekmd
Copy link
Contributor

@derekmd derekmd commented Jan 1, 2019

Fixes: laravel/framework#27023

The documented mailable localization example:

Mail::to($request->user())->send(
    (new OrderShipped($order))->locale('es')
);

would always be sent using the default locale since PendingMail@fill() overrides 'es' with the PendingMail default value which is null.

Mail::to($request->user())->locale('es') should instead be used to set the locale through the mail service.

There may have been confusion since laravel/framework#25752 started allowing this call for a Notification:

$user->notify((new OrderConfirmation($order))->locale('en'))

since there is no intermediate object to assign a locale to.

@taylorotwell taylorotwell merged commit 29bf333 into laravel:5.7 Jan 1, 2019
@derekmd derekmd deleted the correct-mail-set-locale-code-snippet branch January 1, 2019 21:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants