Reputation: 319
I am using laravel 4 and I have created a file inside app/config as follows : The file name is aws.php
<?php
return [
'key' => 'xyz',
];
Now, from my controller I tried to access the key as follows :
$key = Config::get('aws.key');
but it returns null. How can I solve this problem ? I have googled it but have not found the solution.
Upvotes: 1
Views: 2655
Reputation: 89
You can access "key" by Config::get('aws.key');
but need to run this command: php artisan config:clear
Upvotes: 7
Reputation: 202
try
$key = \Config::get('aws.key');
Config is not in the same namespace as class that call this facade, so You want to go to global namespace to search Config class
Upvotes: 1