Skip to content

Releases: waska14/laravel-with-db-transactions

v4.0.0

18 Mar 06:15
Compare
Choose a tag to compare

Add functionality to wrap closure into transaction.

v3.0.0

11 Sep 16:16
Compare
Choose a tag to compare

Rename some methods in WithDBTransactions Helper.

Modify config comments.

Before and after actions / events

19 Mar 07:02
f26b388
Compare
Choose a tag to compare

After version 2.0.0 you can define closures that will be executed before/after commit/rollback(s).

There are 6 static functions that you can call with Waska\LaravelWithDBTransactions\Helpers\WithDBTransactions class:

WithDBTransactions::beforeCommit(callable $closure); // Before committing database transaction
WithDBTransactions::afterCommit(callable $closure); // After committing database transaction
WithDBTransactions::beforeRollback(callable $closure); // Before last rollback
WithDBTransactions::afterRollback(callable $closure); // After last rollback
WithDBTransactions::beforeEveryRollback(callable $closure); // Before every (except last) rollback
WithDBTransactions::afterEveryRollback(callable $closure); // After every (except last) rollback

After version 2.0.0 package dispatches events also.

You can listen them and do whatever you want in listener.

List of events:

  • \Waska\LaravelWithDBTransactions\Events\BeforeBeginTransactionEvent Before begin transaction
  • \Waska\LaravelWithDBTransactions\Events\AfterBeginTransactionEvent After begin transaction
  • \Waska\LaravelWithDBTransactions\Events\BeforeCommitEvent Before commit
  • \Waska\LaravelWithDBTransactions\Events\AfterCommitEvent After commit
  • \Waska\LaravelWithDBTransactions\Events\BeforeRollbackEvent Before latest rollback
  • \Waska\LaravelWithDBTransactions\Events\AfterRollbackEvent After latest rollback
  • \Waska\LaravelWithDBTransactions\Events\BeforeEveryRollbackEvent Before every rollback
  • \Waska\LaravelWithDBTransactions\Events\AfterEveryRollbackEvent After every rollback

Fixed composer.json

16 Mar 10:33
Compare
Choose a tag to compare

Remove unneeded version from composer.json

Initial release

16 Mar 08:32
Compare
Choose a tag to compare

waska14/laravel-with-db-transactions

Are you tired of writing database transactions for every controller method?

This package solves the problem with middleware.

Middleware begins database transaction and depending response (and config also) commits/rollbacks it.