14

in laravel 5 , config/app.php I've set the locale to 'ar' but while trying to get locale in code via: config('app.locale');

I still get 'en'. Seems like config/app.php isn't auto-loaded/updated.

even if config/app.php is empty, executingconfig('app'); returns:

array:10 [▼
"debug" => true
"url" => "http://localhost"
"timezone" => "UTC"
"locale" => "en"
"fallback_locale" => "en"
"key" => "XXXXXXXXXXXXXXXXXXXXXXX" // changed here
"cipher" => "AES-256-CBC"
"log" => "single"
"providers" => array:31 [▶]
"aliases" => array:36 [▶]]

Some hint will be appreciated.

Mehrdad Shokri
  • 1,974
  • 2
  • 29
  • 45

2 Answers2

46

Seems like configuration settings were cached. use php artisan config:clear

apokryfos
  • 38,771
  • 9
  • 70
  • 114
Mehrdad Shokri
  • 1,974
  • 2
  • 29
  • 45
8

Just a minor additional note to this. If you are running a local server on localhost:8000 with php artisan serve and you make changes to either your .env file or in config files, even after clearing the config cache with the steps in the accepted answer, it doesn't update.

You need to stop the local server (control + c in Terminal) and run php artisan serve to start it again - then your changes get picked up.

codewithfeeling
  • 6,236
  • 6
  • 41
  • 53
  • I would have never considered that. That solved not only this problem, even with other configurations. Thank you so much! – Taranis Jun 25 '21 at 09:51