Skip to content

Commit 72e09fb

Browse files
committed
Merge branch 'transactions' into 4.1
2 parents 1253c98 + f8f6ff9 commit 72e09fb

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

database.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,20 @@ To run a set of operations within a database transaction, you may use the `trans
8989
DB::table('posts')->delete();
9090
});
9191

92+
> **Note:** Any exception thrown within the `transaction` closure will cause the transaction to be rolled back automatically.
93+
94+
Sometimes you may need to begin a transaction yourself:
95+
96+
DB::beginTransaction();
97+
98+
You can rollback a transaction via the `rollback` method:
99+
100+
DB::rollback();
101+
102+
Lastly, you can commit a transaction via the `commit` method:
103+
104+
DB::commit();
105+
92106
<a name="accessing-connections"></a>
93107
## Accessing Connections
94108

0 commit comments

Comments
 (0)