0

I try to set fallback locale dynamically through web using config set with the key of app.fallback_locale. But its did not work.

config()->set('app.fallback_locale', 'ms')

Is there something I missing?

bad_coder
  • 11,289
  • 20
  • 44
  • 72
  • Is `fallback_locale` set in your `config/app.php`? What does "it did not work" mean, exactly, how are you testing and what are you seeing? – Don't Panic Aug 28 '21 at 06:29

1 Answers1

1

Try this:

Set fallback_locale in app.php,

'fallback_locale' => 'ms',

Try clearing your config cache, before accessing it

php artisan config:clear

You can try using php artisan tinker and run

config('app.locale');
OR    
App::getLocale()

Hope this works in your case!!

Ankit Jindal
  • 3,672
  • 3
  • 25
  • 37