Laravel 5.7 Mail Localization Improvements

Laravel 5.7.7 is now released and includes both bug fixes and thanks to Derek MacDonald a big improvement to Mail Localization. With the release of Laravel 5.7 the Illuminate\Notifications\Notification class started offering a locale method to set the desired language. The application will change into this locale when the notification is being formatted and then revert back to the previous locale when formatting is complete. Here is an example of this feature: Now with Laravel 5.7.7 you can take this a step further and hook directly into a user model. In a typical application you might have a locale field on the user table and now you can define the User model as follows: Now pretend you create a user from Germany: The following four calls will send the notification to the user in German:

Read Full Article at

Tags: , , , , , , , , , , , , , , ,