Laravel 10 Get env Variable in Blade Controller
To get an environment variable in a Laravel controller, you can use the env() helper function. The syntax is:
env('VARIABLE_NAME')
For example, to get the value of APP_NAME, you can use:
$name = env('APP_NAME')
To get an environment variable in Laravel Blade, you can use the env() function. The syntax is env('VARIABLE_NAME'). If the variable exists, its value will be returned. If the variable doesn't exist, the default value will be returned, which is null by default.
Top comments (0)