We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 9f8f242 commit e98ac6bCopy full SHA for e98ac6b
database.md
@@ -379,6 +379,20 @@ DB::transaction(function () {
379
});
380
```
381
382
+You may optionally pass a closure to the `transaction` method that will be executed if the transaction fails:
383
+
384
+```php
385
+use Illuminate\Support\Facades\DB;
386
387
+DB::transaction(function () {
388
+ DB::update('update users set votes = 1');
389
390
+ DB::delete('delete from posts');
391
+}, onFailure: function () {
392
+ // ...
393
+});
394
+```
395
396
<a name="handling-deadlocks"></a>
397
#### Handling Deadlocks
398
0 commit comments