Answer the question
In order to leave comments, you need to log in
Why doesn't laravel want to pull a variable from .env with cached configs?
There is a .env file on the server that has the TICK=0 variable.
When the config is not cached, then env('TICK') works fine. But one has only to write php artisan optimize in the console and the application no longer sees this variable and issues NULL.
I went into bootstrap/cache/config.php and didn’t see my TICK variable there, for that there are other variables from .env there.
How to make my TICK variable get into the config when caching?
Answer the question
In order to leave comments, you need to log in
The function env()
cannot be used in code.
The only place where it can be used is in the config files from the /config
Ie directory. You need, for example, in the /config/app.php file to set the configuration variable
//...
'tick' => env('TICK'),
// ..
$tick = config('app.tick');
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question