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.:
{{ env('APP.ENV') }} // nothing {{ env('APP_ENV') }} // nothing {{ env('APP_ENV'), 'test' }} // returns 'test'
Could someone help me call the google maps api and overheidio api key in the blade?
The . env file contains the individual user environment variables that override the variables set in the /etc/environment file. You can customize your environment variables as desired by modifying your . env file.
Five most important commands if your Laravel is not working as expected after some modifications in .env or database folder or because of any other modifications. Here is full explanation: https://www.youtube.com/watch?v=Q1ynDMC8UGg
php artisan config:clear php artisan cache:clear composer dump-autoload php artisan view:clear php artisan route:clear
I have it implemented in the following way:
@if (env('APP_ENV')!='Production') Enviroment Test @endif
My recommendation is to execute the following command: composer self-update
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With