Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Laravel config/app.php not updating

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.

like image 981
Mehrdad Shokri Avatar asked Sep 15 '15 12:09

Mehrdad Shokri


People also ask

Where is config PHP in Laravel?

All of the configuration files for the Laravel framework are stored in the app/config directory. Each option in every file is documented, so feel free to look through the files and get familiar with the options available to you.

Where is .ENV file in Laravel?

In a fresh Laravel installation, the root directory of your application will contain a .env.example file that defines many common environment variables.

What is config cache Laravel?

Configuration. Laravel provides a unified API for various caching systems. The cache configuration is located at config/cache. php . In this file you may specify which cache driver you would like used by default throughout your application.


2 Answers

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

like image 57
Mehrdad Shokri Avatar answered Oct 11 '22 14:10

Mehrdad Shokri


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.

like image 29
codewithfeeling Avatar answered Oct 11 '22 14:10

codewithfeeling