-1

I have my server key in .env on production but sometimes notification stops working as server key not accessable .

But when I run the command php artisan config:cache then it again starts working .

1 Answers1

3

Do not access the variable of .env directly in controller or inside any file. First you have to access that variable in any config file. Like below:

For e:g; inside config/app.php define your server key 'server_key' => env('server_key')

after defining above key in config/app.php you have to access it inside any file as below: config('app.server_key')

By doing this you will permanantly resolve your issue.

Bhatt Akshay
  • 159
  • 1
  • 14