In a blade template, you can access the environment variables using the env() helper function. For example, if you have an environment variable named APP_NAME, you can access it in your blade template like this:
{{ env(‘APP_NAME’) }}
In a controller, you can access the environment variables using the env() helper function. For example, if you have an environment variable named APP_NAME, you can access it in your controller like this:
$appName = env(‘APP_NAME’);
How to get .env variable in blade or controller