mtvs_dev's avatar

Access to Config service inside App\Console\Kernel::schedule()

I want to get a couple of config values in the App\Console\Kernel::schedule() but the following error occurs:

ReflectionException: Class config does not exist in /home/vagrant/Code/sm/vendor/laravel/framework/src/Illuminate/Container/Container.php on line 776

Probably the bindings hasn't happened yet, Is there a solution for this?

I want to set up the scheduling based on my config values.

0 likes
5 replies
mstnorris's avatar

@mtvs_dev Have you got the namespace correct?

Can you post your app\Console\Kernel::schedule()

mstnorris's avatar

@mtvs_dev does this question help? Again, can you show us the code that is causing this error. As I asked above, but not sure if you saw it, does it have the correct namespace?

mtvs_dev's avatar

@mstnorris I just call config('file.key') inside the App\Console\Kernel::schedule() and I don't change its namespace.

mtvs_dev's avatar
mtvs_dev
OP
Best Answer
Level 2

I just needed to call the $this->bootstrap() inseide the App\Console\Kernel::schedule().

Please or to participate in this conversation.