Laravel - Queues - Specifying Commit Dispatch Behavior Inline

If you do not set the after_commit queue connection configuration option to true, you may still indicate that a specific job should be dispatched after all open database transactions have been committed. To accomplish this, you may chain the afterCommit method onto your dispatch operation:

    
    use App\Jobs\ProcessPodcast;
    
    ProcessPodcast::dispatch($podcast)->afterCommit();
	

Likewise, if the after_commit configuration option is set to true, you may indicate that a specific job should be dispatched immediately without waiting for any open database transactions to commit:

    
    ProcessPodcast::dispatch($podcast)->beforeCommit();