Комментарии:
thanks!
what about the unit / feature tests?
do we use only config() there, too ?
A classic case of premature optimization. I wish the Laravel team made the config cache optional, instead of loading it by default.
ОтветитьCan I recommend renaming the video to "Why you should not use env() outside of Laravel config files?". The same problem is present in all files except config files :)
ОтветитьWhat about in FrontEnd?
ОтветитьDamn, I wish I knew.
ОтветитьWhat would be the best approach to keeping global variables, let's say constants. I've seen people recommending keeping a custom config file named "constants". Is there a better bulletproof approach than that?
ОтветитьThank you, Povilas. I've always know it was best practice to use config and only ever use the env() function from within your configuration files, but I never bothered to question why that was and see demonstrations of issues it can lead to. One thing your video has taught me is that I should start using config cache on my applications and will be doing so in the near future.
ОтветитьYou convinced me to use config instead of env out of laziness
ОтветитьAwesome. I see people do this constantly. I will link to this video instead of the docs from now on 👍
ОтветитьSome people say that you should not send the .env file to the server. Is it a security risk?
ОтветитьOn every deployment, i run the command:
php artisan optimize:clear
Which clears:
Cached config
Cached views
Cached routes
...
or run the command:
php artisan optimize
which clears all the cached config, views...
And create a new cache for all.
Aaaahh .. now I know why everytime I use artisan config:cache I hit the wall 😂 Thank for the tip! 👍
ОтветитьGreat 👍🏻 teacher
ОтветитьHello dear author, i bought filament course but, in first lesson, after instaling, i got css error. How to fix it
ОтветитьHow much faster goes the app after running config:cache?🤔
Ответитьyou're the man 👏👏👏👏👏👏👏👏
Ответитьthanks, very helpful
ОтветитьWhy doesn't the env function load the cached value when used in a controller? Is that purposeful design?
ОтветитьYour tips helped me out when I was starting out with laravel development. Especially those old articles you have on your website. I've been recommending your channel ever since.
Ответитьyeah I've experience with this implementation before must be in config.
ОтветитьI used to use env until laravel started to cache by default and it broke everything 😂😂
Ответитьhi Mauricio Pochettino
Ответитьenv, tends to be empty due to cache and cause hell of fun :)) (if recall correctly this issue appeared in laravel 7 or 8, since in core were changed introduced)
Ответитьthx
Ответитьshort trick and super informative
thx ❤️🔥
I already knew that, I've learned the hard way... after 4hrs of debuggin 😅
ОтветитьNice! + Also you can create your own config file too instead of putting them in config.php if you have a lot of custom configuration fields.
ОтветитьThis is helpful, i will give it a try and see where it's getting stored and the time difference between cached vs non-cached config for our one of the full-blown project
Ответить