Thursday, March 30, 2017

Accesing Laravel .env variables in blade

I am trying to get some API keys which I have stored in my .env file to use in the blade javascript. I have added two keys like:

APP_ENV=local
APP_KEY=////
APP_DEBUG=true
APP_LOG_LEVEL=debug
APP_URL=http://localhost
APP_GOOGLE_MAPS=////
APP_OVERHEID_IO=////

In blade I need to use the Google Maps API and OverheidIO API key. I have tried getting one of the default .env variables just in case I have formatted the custom .env variables wrong.:

 // nothing
 // nothing
 // returns 'test' 

Could someone help me call the google maps api and overheidio api key in the blade?



via Anna Jeanine

Advertisement