From c29c6ba480637ee751550ffeed737a242ec7f9b6 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Tue, 11 Aug 2020 11:13:49 +1000 Subject: [PATCH] Cleanup for Custom Translations --- app/Providers/NinjaTranslationServiceProvider.php | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/app/Providers/NinjaTranslationServiceProvider.php b/app/Providers/NinjaTranslationServiceProvider.php index bf7d0c73243c..df58fcabc6fd 100644 --- a/app/Providers/NinjaTranslationServiceProvider.php +++ b/app/Providers/NinjaTranslationServiceProvider.php @@ -18,8 +18,21 @@ class NinjaTranslationServiceProvider extends TranslationServiceProvider { public function boot() { - //parent::boot(); + /** + * To reset the translator instance we call + * + * App::forgetInstance('translator'); + * + * Why? As the translator is a singleton it persists for its + * lifecycle + * + * We _must_ reset the singleton when shifting between + * clients/companies otherwise translations will + * persist. + * + */ + $this->app->singleton('translator', function($app) { $loader = $app['translation.loader'];