When I output env('APP_ENV'), it returns "staging". However, my env('APP_ENV') should actually be "local", and it isn't updating properly. I ran php artisan config:cache and php artisan config:clear but it still remains "staging", and I didn't change the value anywhere else. Is there a reason for this?
Got it. However, it still returns "staging" instead of "local".
It seems I have done this:
If you execute the config:cache command during your deployment process, you should be sure that you are only calling the env function from within your configuration files. Once the configuration has been cached, the .env file will not be loaded; therefore, the env function will only return external, system level environment variables.
Well it is a bit late to fix that now. I meant how I can reverse it so that it reads from my .env file instead of the system level or wherever it is reading my variables from now.
That was not the case for me. This is the only project I was working on where I used php artisan config:cache, and I have not worked on another project. I have uploaded this one to a "staging" environment, but I have not run any command line commands in that environment, and the files are almost exactly the same for both.
I don't think I'm able to run command line commands on that server (I don't know enough and don't want to break anything already existing), so I created a new variable in my app.php file called environment and setting that to local, while creating it in my .env file and pointing everything to environment instead of env. Though it's not a great fix, will this be okay?