Skip to content

Run Laravel job inside transaction (after transaction is committed, or cancel if rolled back)

License

Notifications You must be signed in to change notification settings

littlemiaor/laravel-transactional-jobs

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Laravel transactional jobs

Dispatch jobs inside transactions. Cancel job on transaction rollback. Add to queue on transaction committed.

Installation

  1. Run composer require therezor/laravel-transactional-jobs in your laravel project root folder

  2. Implement TheRezor\TransactionalJobs\Contracts\TransactionalJob to jobs that runs in the middle of transactions

<?php

use TheRezor\TransactionalJobs\Contracts\RunAfterTransaction;

class MySuperJob implements ShouldQueue, RunAfterTransaction
{
    use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
    
    ...
}

About

Run Laravel job inside transaction (after transaction is committed, or cancel if rolled back)

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 100.0%