Rumel
Rumel

Reputation: 319

Laravel 4 Config::get() returns null

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

Answers (2)

Swapnil Ahire
Swapnil Ahire

Reputation: 89

You can access "key" by Config::get('aws.key'); but need to run this command: php artisan config:clear

Upvotes: 7

Janko
Janko

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

Related Questions