fix(i18n): remove stale redis del pattern, drop dead singleton
parent
b121520ed6
commit
5c5ddbbe83
|
|
@ -15,14 +15,11 @@ class AppServiceProvider extends ServiceProvider
|
|||
*/
|
||||
public function register(): void
|
||||
{
|
||||
$this->app->singleton('translation.loader', fn() => new DatabaseTranslationLoader);
|
||||
|
||||
// TranslationServiceProvider is deferred and re-binds translation.loader
|
||||
// when it resolves. We extend 'translator' to swap in our DB loader after
|
||||
// the translator instance is created.
|
||||
// TranslationServiceProvider is deferred and re-binds translation.loader when it
|
||||
// resolves. We extend 'translator' to swap in our DB loader after the instance is
|
||||
// created, then freeze it in the container so app('translation.loader') is consistent.
|
||||
$this->app->extend('translator', function ($translator, $app) {
|
||||
$loader = new DatabaseTranslationLoader;
|
||||
// Keep the singleton up-to-date so app('translation.loader') returns ours.
|
||||
$app->instance('translation.loader', $loader);
|
||||
$prop = new \ReflectionProperty($translator, 'loader');
|
||||
$prop->setValue($translator, $loader);
|
||||
|
|
|
|||
|
|
@ -6,14 +6,12 @@ use Illuminate\Support\Facades\Redis;
|
|||
|
||||
beforeEach(function () {
|
||||
Redis::del('lang:*:de:auth');
|
||||
Redis::del('lang:de:auth');
|
||||
app('translator')->setLoaded([]);
|
||||
});
|
||||
|
||||
afterEach(function () {
|
||||
app('translator')->setLoaded([]);
|
||||
Redis::del('lang:*:de:auth');
|
||||
Redis::del('lang:de:auth');
|
||||
});
|
||||
|
||||
it('loads translation from database via __()', function () {
|
||||
|
|
|
|||
Loading…
Reference in New Issue