Custom Jobs Dispatching

To disable counters aggregating using default jobs queue you have to disable auto-registering of the LoveEventServiceProvider provider.

You can use opt-out package discovery in composer.json of your application.

"extra": { "laravel": { "dont-discover": [ "cybercog/laravel-love" ] } },

This will disable auto-discovery of 2 service providers:

  • Cog\Laravel\Love\LoveServiceProvider
  • Cog\Laravel\Love\LoveEventServiceProvider

Then you have to re-register Cog\Laravel\Love\LoveServiceProvider manually in config/app.php file, because it contains core functionality.

'providers' => [ ... \Cog\Laravel\Love\LoveServiceProvider::class, ],

Then you will be able to call synchronously increment and decrement aggregate counters:

  • IncrementReactionAggregatesJob::dispatch()->onConnection('sync');
  • DecrementReactionAggregatesJob::dispatch()->onConnection('sync');