A free open source IT asset/license management system
Correct way to append locale
Godfrey M6cc8ec63bec8
diff --git a/app/Actions/CheckoutRequests/CreateCheckoutRequestAction.php b/app/Actions/CheckoutRequests/CreateCheckoutRequestAction.phpindex 68782c90bf..55647d45dd 100644--- a/app/Actions/CheckoutRequests/CreateCheckoutRequestAction.php+++ b/app/Actions/CheckoutRequests/CreateCheckoutRequestAction.php@@ -44,7 +44,7 @@ class CreateCheckoutRequestAction$asset->request();$asset->increment('requests_counter', 1);try {- $settings->notify(new RequestAssetNotification($data));+ $settings->notify((new RequestAssetNotification($data))->locale($settings->locale));} catch (\Exception $e) {Log::warning($e);}diff --git a/app/Http/Controllers/ViewAssetsController.php b/app/Http/Controllers/ViewAssetsController.phpindex e03c820688..604a280373 100755--- a/app/Http/Controllers/ViewAssetsController.php+++ b/app/Http/Controllers/ViewAssetsController.php@@ -205,7 +205,7 @@ class ViewAssetsController extends Controller$logaction->logaction(ActionType::RequestCanceled);if (($settings->alert_email != '') && ($settings->alerts_enabled == '1') && (! config('app.lock_passwords'))) {- $settings->notify(new RequestAssetCancelation($data));+ $settings->notify((new RequestAssetNotification($data))->locale($settings->locale));}return redirect()->back()->with('success')->with('success', trans('admin/hardware/message.requests.canceled'));@@ -213,7 +213,7 @@ class ViewAssetsController extends Controller$item->request();if (($settings->alert_email != '') && ($settings->alerts_enabled == '1') && (! config('app.lock_passwords'))) {$logaction->logaction('requested');- $settings->notify(new RequestAssetNotification($data));+ $settings->notify((new RequestAssetNotification($data))->locale($settings->locale));}return redirect()->route('requestable-assets')->with('success')->with('success', trans('admin/hardware/message.requests.success'));diff --git a/app/Notifications/RequestAssetNotification.php b/app/Notifications/RequestAssetNotification.phpindex a454981ed2..0a95ca7413 100644--- a/app/Notifications/RequestAssetNotification.php+++ b/app/Notifications/RequestAssetNotification.php@@ -102,8 +102,6 @@ class RequestAssetNotification extends Notificationif (($this->item->model) && ($this->item->model->fieldset)) {$fields = $this->item->model->fieldset->fields;}- $originalLocale = app()->getLocale();- app()->setLocale($this->settings->locale);$message = (new MailMessage)->markdown('notifications.markdown.asset-requested',[@@ -123,8 +121,6 @@ class RequestAssetNotification extends Notification'X-System-Sender', 'Snipe-IT');});-- app()->setLocale($originalLocale);return $message;}