简体   繁体   中英

Laravel disable provider (Clockwork) on fly

I'm having a laravel setup with the Clockwork installed. And I have a artisan command that takes really long time to run, so that clockwork will consume too much memory. I still need that extension. How can I disable it when just running a command?

you can override this in the config file clockwork.php

run php artisan vendor:publish --provider='Clockwork\\Support\\Laravel\\ClockworkServiceProvider'

then apply your condition on 'enable'

You could try:

  1. Publish the clockwork.php configuration file:
    Ie: Run the command:
php artisan vendor:publish --provider='Clockwork\Support\Laravel\ClockworkServiceProvider'

Then it will give you a clockwork config file ( config/clockwork.php ).

  1. Use the script below to temporarily disable and re-enable clockwork after your "data-intense" commands.

config()->set('clockwork.enable', false);

//  A few data-intense commands here...

config()->set('clockwork.enable', true);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM