Reputation: 4152
Is it possible to use the config()
helper method within the
config/app.php
file its self??
I can't seem to get it to work. It just ignore it.
Example;
return [
'extra' => 'test',
'pages' => [
'one',
'two',
'three',
'demographics',
'results',
config('app.extra')
],
];
....from within the app.php file config('app.extra')
does nothing.
Upvotes: 0
Views: 1429
Reputation: 3967
Let's do a little experiment :D
Put three files in your config a.php
, b.php
and c.php
and put these values:
a.php:
<?php
return ['name' => 'a'];
b.php
<?php
return [
'name' => 'b',
'name_of_1' => config('a.name')
'name_of_3' => config('c.name')
];
and c.php
<?php
return ['name' => 'c'];
Now from b.php you can access values of a.php but not of c.php
So...
dd(config(b.name)) //b
dd(config(b.name_of_1)) //a
dd(config(b.name_of_3)) //null
Conclusion You can only access values of previous config files from one config file. (And by previous it means alphabetically)
Upvotes: 2