How to Get .env Variable in Blade or Controller file
We can get .env variable in blade or controller I will guide you with step by step example we can print env file variable by using env().
Syntax :
env('VARIABLE_NAME');
Example :
env('APP_URL');
how you can get env file variable in blade or controller file.
Blade File :
@if (env('APP_ENV') == 'local')
Local Enviroment
@endif
Controller File :
if (env('APP_ENV') == 'local'){
echo 'Local Enviroment';
}