In my .env file I have the following:
IMAP_HOSTNAME_TEST=imap.gmail.com IMAP_USERNAME_TEST=myemail@gmail.com IMAP_PASSWORD_TEST=mypw
Now I
In config/app.php file make a instance of env variable like 'name' => env('APP_NAME', 'Laravel') & In your controller call it like config('app.name')
'name' => env('APP_NAME', 'Laravel')
config('app.name')
Run following commands php artisan config:cache php artisan cache:clear if it is not working.
php artisan config:cache
php artisan cache:clear