Commit

4b2c117

An underrated Laravel feature I use all the time in my Action classes: afterCommit(). If you're dispatching jobs inside database transactions, this little gem ensures they’re only dispatched after the transaction successfully commits.
app/Actions/CompleteOrderAction.php
DB::transaction(function () use ($order) {

    $order->update(['status' => 'paid']);

    SendOrderConfirmation::dispatch($order)->afterCommit();

});
Simple, clean, and saves you from some nasty race conditions. That's why I love using @laravel !

commit 4b2c117