Ti consiglio di non usare env() fuori dai file di configurazione ma di aggiungere i valori che ti servono in config/services.php in modo da non scontrarti con problemi di caching:
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.

Rispondi quotando
