nazmun
November 28, 2022, 12:40pm
1
I am trying to get variables from laravel config files. For example, I set the application name in config/app.php
file.
'name' => env('APP_NAME', 'BMS'),
Now I want to show the app name in my web page title.
<title>Accounts - BMS</title>
So how can I get the config variables APP_NAME
into the laravel blade template?
You can use Config
class or config()
helper function to get the config variables.
<title>Accounts - {{ Config::get('app.name') }}</title>
<!-- or -->
<title>Accounts - {{ config('app.name') }}</title>
Here app
represents the file name. suppose you want to get a config variable from config/database.php
you need to put database.variable_name
. For example config('database.default')