Wrapping related writes in a transaction is easy to get subtly wrong. Laravel's DB::transaction() closure handles commit, rollback, and deadlock retries for you.
Wrapping related writes in a transaction is easy to get subtly wrong. Laravel's DB::transaction() closure handles commit, rollback, and deadlock retries for you.