Skip to content

Commit e8f8f31

Browse files
authored
Small clarification database transaction exceptions (#7471)
I was looking for the (re) throw behaviour of exceptions in a `DB::transaction()` call. Looked it up in the code and thought it'd be good to mention in the docs.
1 parent 8349059 commit e8f8f31

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

database.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ If you would like to specify a closure that is invoked for each SQL query execut
263263
<a name="database-transactions"></a>
264264
## Database Transactions
265265

266-
You may use the `transaction` method provided by the `DB` facade to run a set of operations within a database transaction. If an exception is thrown within the transaction closure, the transaction will automatically be rolled back. If the closure executes successfully, the transaction will automatically be committed. You don't need to worry about manually rolling back or committing while using the `transaction` method:
266+
You may use the `transaction` method provided by the `DB` facade to run a set of operations within a database transaction. If an exception is thrown within the transaction closure, the transaction will automatically be rolled back and the exception is re-thrown. If the closure executes successfully, the transaction will automatically be committed. You don't need to worry about manually rolling back or committing while using the `transaction` method:
267267

268268
use Illuminate\Support\Facades\DB;
269269

0 commit comments

Comments
 (0)