How to Access Config Value in Laravel?

Admin   Laravel   296  2021-03-16 23:20:07

Hi Guys,

In this Example,I will learn you how to get value from confige file in laravel.you can simply get config value in laravel.

you will use confige() method in controller then get confige file value in your controller.

Example 1 :

 

/**

* The attributes that are mass assignable.

*

* @var array

*/

public function index()

{

$config = config('database.default');

dd($config);

}

output :

 

"mysql" //database name

Example 2 :

 

/**

* The attributes that are mass assignable.

*

* @var array

*/

public function index()

{

$config =Config::get('app.name');

dd($config);

}

output :

 

'Laravel'

It will help you.....