If you have some part of your code which you want to execute only if a certain environment variable exists in the .env file. Here is how you can check the existence of environment variable in your .env file in Laravel
if(env('MY_PROPERTY') !== null)
If there is a case that the property is defined with the empty value, you can also include that in your condition
if(env('MY_PROPERTY') !== null && env('MY_PROPERTY') !== '')
That's about it !