Skip to content

Commit 103261a

Browse files
authored
call transaction callbacks after updating the transaction levels (#36890)
1 parent 96334c9 commit 103261a

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/Illuminate/Database/Concerns/ManagesTransactions.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,13 @@ public function transaction(Closure $callback, $attempts = 1)
4141
}
4242

4343
try {
44-
if ($this->transactions == 1) {
44+
$this->transactions = max(0, $this->transactions - 1);
45+
46+
if ($this->transactions == 0) {
4547
$this->getPdo()->commit();
4648

4749
optional($this->transactionsManager)->commit($this->getName());
4850
}
49-
50-
$this->transactions = max(0, $this->transactions - 1);
5151
} catch (Throwable $e) {
5252
$this->handleCommitTransactionException(
5353
$e, $currentAttempt, $attempts

0 commit comments

Comments
 (0)