Laravel 9 - Problems with Caching Custom Configuration Values in Different Environments
I'm writing unit tests and I tried several approaches but none seem to work... I'm confused about Quick question that's been bugging me - I'm working with an scenario with caching custom configuration values in my Laravel 9 application. I've created a custom config file located at `config/myconfig.php`, which contains some environment-specific values. However, when I cache the configuration using the `php artisan config:cache` command, it seems to retain the values from my local `.env` file instead of updating to the production environment when deployed. Hereβs a snippet of my `config/myconfig.php`: ```php return [ 'api_key' => env('MYAPI_KEY', 'default_key'), 'endpoint' => env('MYAPI_ENDPOINT', 'https://default.endpoint'), ]; ``` In my `.env` file for production, I've set: ``` MYAPI_KEY=prod_api_key MYAPI_ENDPOINT=https://prod.endpoint ``` After running `php artisan config:cache`, I verified the cache by using: ```php $value = config('myconfig.api_key'); dd($value); ``` This returns `default_key` instead of `prod_api_key`. I've tried clearing the configuration cache with `php artisan config:clear` and then re-caching it, but the scenario continues. The production environment is correctly set up and the `.env` file is loading as expected. Are there any known issues with caching configurations or should I be using a different method to ensure these values are updated correctly? Any insights would be appreciated. How would you solve this? I'd love to hear your thoughts on this. I'm working on a application that needs to handle this. Thanks for any help you can provide! I've been using Php for about a year now. Am I missing something obvious?