michaelnguyen547
10 months ago

handle deadlock with manual transaction

Posted 10 months ago by michaelnguyen547

I am aware that Laravel support deadlock with db transaction automatically

DB::transaction(function () {
    DB::table('users')->update(['votes' => 1]);

    DB::table('posts')->delete();
}, 5);

I am curious that in case of manual transaction using DB::beginTransaction() , DB::commit() and DB::rollback(). How can I handle deadlock ?

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