Did you know? If you've cached your laravel configuration files with $ php artisan config:cache, env() function calls from everywhere except the config files will return null.

Loose recommendation: avoid using env() anywhere in your application as this will give you headaches when you're running in production. Only use env() inside your configuration files.