Fixing wrong locale in Admin notifications

Starting from Laravel 5.2, as stated in documentation (https://laravel.com/docs/5.2/upgrade#upgrade-5.2.0): 

Caching And Env
If you are using the config:cache command during deployment, you must make sure that you are only calling the env function from within your configuration files, and not from anywhere else in your application.
If you are calling env from within your application, it is strongly recommended you add proper configuration values to your configuration files and call env from that location instead, allowing you to convert your env calls to config calls.
This commit is contained in:
Caine85 2021-01-03 12:40:35 +01:00 committed by GitHub
parent c401313f4d
commit dec3757605
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 4 deletions

View File

@ -35,7 +35,7 @@ class Order
/* email to admin */
$configKey = 'emails.general.notifications.emails.general.notifications.new-admin';
if (core()->getConfigData($configKey)) {
$this->prepareMail(env('APP_LOCALE'), new NewAdminNotification($order));
$this->prepareMail(config('app.locale'), new NewAdminNotification($order));
}
} catch (\Exception $e) {
report($e);
@ -112,7 +112,7 @@ class Order
/* email to admin */
$configKey = 'emails.general.notifications.emails.general.notifications.new-inventory-source';
if (core()->getConfigData($configKey)) {
$this->prepareMail(env('APP_LOCALE'), new NewInventorySourceNotification($shipment));
$this->prepareMail(config('app.locale'), new NewInventorySourceNotification($shipment));
}
} catch (\Exception $e) {
report($e);
@ -137,7 +137,7 @@ class Order
/* email to admin */
$configKey = 'emails.general.notifications.emails.general.notifications.new-admin';
if (core()->getConfigData($configKey)) {
$this->prepareMail(env('APP_LOCALE'), new CancelOrderAdminNotification($order));
$this->prepareMail(config('app.locale'), new CancelOrderAdminNotification($order));
}
} catch (\Exception $e) {
report($e);
@ -189,4 +189,4 @@ class Order
app()->setLocale($locale);
Mail::queue($notification);
}
}
}