How to pass active locale/lang to mail templates data
0
use Event; use App; use System\Classes\MailManager; ...
public function boot()
{
Event::listen('mailer.beforeAddContent', function ($mailer, $message, $view, $data, $raw, $plain) {
$data['_current_locale'] = !empty($data['_current_locale']) ? $data['_current_locale'] : App::getLocale();
if (MailManager::instance()->addContentToMailer($message, $view, $data, $plain)) {
// the caller who fired the event is expecting a FALSE response to halt the event
return false;
}
}, 1);
}
There are no comments yet
Be the first one to comment