DoeJohn
3 months ago

Transaction Inside Transaction (nested transactions) - any problems?

Posted 3 months ago by DoeJohn

I'm using Laravel 5.8 & MySQL (InnoDB). Will nested transactions work? For example:

        DB::transaction(function () {
            // Some code

            DB::transaction(function () {
                // Some code
            });

            // Some code
        });

I know that this may look weird and you may ask "why would you have something like this at all?"... but I was just wondering :) I tested and it seems to work normally, but maybe there's something I need to be aware of??

Please sign in or create an account to participate in this conversation.