Reputation: 2040
I get config values in Laravel like this:
$value = config('app.name');
If I try the same in a method, which is called from an artisan command, then I get the following error message:
[ErrorException] Trying to get property of non-object
Is it possible to get config values from an artisan console command?
I have found a solution for Laravel 4, but there is no such method in Laravel 5.
Upvotes: 4
Views: 3892
Reputation: 1379
config()
helper use application instance and it can be not available in the console. Try this solution Config::get('app.name')
Upvotes: 4