trait
Illuminate
/
Database
/
Concerns
/
ManagesTransactions
You are viewing an older version of the documentation. For the latest, please visit master documentation.
ManagesTransactions
Methods
public
transaction ( Closure $callback , $attempts ) : mixed
Execute a Closure within a transaction.
Parameters
- $callback Closure
- $attempts int
protected
handleTransactionException ( Throwable $e , $currentAttempt , $maxAttempts ) : void
Handle an exception encountered when running a transacted statement.
Parameters
- $e Throwable
- $currentAttempt int
- $maxAttempts int
public
beginTransaction ( ) : void
Start a new database transaction.
protected
createTransaction ( ) : void
Create a transaction within the database.
protected
createSavepoint ( ) : void
Create a save point within the database.
protected
handleBeginTransactionException ( Throwable $e ) : void
Handle an exception from a transaction beginning.
Parameters
- $e Throwable
public
commit ( ) : void
Commit the active database transaction.
protected
handleCommitTransactionException ( Throwable $e , $currentAttempt , $maxAttempts ) : void
Handle an exception encountered when committing a transaction.
Parameters
- $e Throwable
- $currentAttempt int
- $maxAttempts int
public
rollBack ( $toLevel ) : void
Rollback the active database transaction.
Parameters
- $toLevel int|null
protected
performRollBack ( $toLevel ) : void
Perform a rollback within the database.
Parameters
- $toLevel int
protected
handleRollBackException ( Throwable $e ) : void
Handle an exception from a rollback.
Parameters
- $e Throwable
public
transactionLevel ( ) : int
Get the number of active transactions.
public
afterCommit ( $callback ) : void
Execute the callback after a transaction commits.
Parameters
- $callback callable