ManagesTransactions
trait ManagesTransactions (View source)
Methods
Handle an exception encountered when running a transacted statement.
Start a new database transaction.
Create a transaction within the database.
Create a save point within the database.
Commit the active database transaction.
Handle an exception encountered when committing a transaction.
Rollback the active database transaction.
Perform a rollback within the database.
Get the number of active transactions.
Details
mixed
transaction(Closure $callback, int $attempts = 1)
Execute a Closure within a transaction.
protected void
handleTransactionException(Exception $e, int $currentAttempt, int $maxAttempts)
Handle an exception encountered when running a transacted statement.
void
beginTransaction()
Start a new database transaction.
protected void
createTransaction()
Create a transaction within the database.
protected void
createSavepoint()
Create a save point within the database.
protected void
handleBeginTransactionException(Throwable $e)
Handle an exception from a transaction beginning.
void
commit()
Commit the active database transaction.
protected void
handleCommitTransactionException(Exception $e, int $currentAttempt, int $maxAttempts)
Handle an exception encountered when committing a transaction.
void
rollBack(int|null $toLevel = null)
Rollback the active database transaction.
protected void
performRollBack(int $toLevel)
Perform a rollback within the database.
protected void
handleRollBackException(Exception $e)
Handle an exception from a rollback.
int
transactionLevel()
Get the number of active transactions.
Laravel Cloud is the best place to deploy Laravel, Nuxt, Express, Hono, Node.js, Bun, Go, Flask, Python, and more, with dedicated infrastructure available on AWS through Laravel Private Cloud.