Complete the code to get the value of an environment variable in Laravel.
$value = env([1]);In Laravel, the env function requires the environment variable name as a string, so it must be in quotes.
Complete the code to set a default value when an environment variable is missing.
$value = env('APP_ENV', [1]);
The second argument to env is the default value returned if the variable is not set. It must be a string in quotes.
Fix the error in the code to correctly access the database host from the environment.
"DB_HOST=[1]"
To get the database host value from the environment in Laravel, use env('DB_HOST'). The other options are either incorrect syntax or not Laravel standard.
Fill both blanks to correctly define and access a custom environment variable.
In .env file: CUSTOM_VAR=[1] In code: $value = env([2]);
In the .env file, values are assigned without quotes unless spaces exist, so quotes are optional but recommended for clarity. In code, the variable name must be a string in quotes.
Fill all three blanks to create a Laravel config entry that uses an environment variable with a default fallback.
"'timezone' => env([1], [2]), // Default is [3]"
The environment variable name must be a string in quotes. The default fallback should be a string in quotes. The comment shows the default value as a plain string for clarity.