'Laravel 8 config:cache allowing sending emails but can't read env variables after config:cache

hope you are all fine. I am facing an issue when I am running command

php artisan config:cache

email is sending but I can't read env('DB_HOST') variables.

Similarly when I run then this time:

php artisan config:clear

email is not sending, now I can read env('DB_HOST') variables.

I don't understand what is issue.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source