Laravel How to Get .env Variable in Controller and Blade
In this tutorial I will give you information laravel how to get .env variable in controller and blade. many time we need to required of .env variable in controller and blade file like if you are creating google map integration then you have stored app id and secret key in env file. But if you haven't any idea how to get it in controller or blade file. You can also set app URL and many other things on .env file.
So, let's check how to get those variable data from .env file.
just put the same line in your .env file.
Access set variable in .env file using env() function.
@if(env('APP_ENV') == 'local')
if(env('APP_ENV') == 'local')
So, it is very simple to get variable data from .env file like this.
You might also like :