Skip to content

AnourValar/laravel-atom

Repository files navigation

Laravel ACID API

Installation

composer require anourvalar/laravel-atom

Usage

Action after transaction commit

Atom::onCommit(function () {
    dispatch(new Job());
});

Action after transaction rollBack

Atom::onRollBack(function () {
    Storage::delete('file.jpg');
});

Pessimistic lock

Atom::lock('user');
Atom::lockUser($user->id); // equals to: Atom::lock('user', $user->id);

Optimistic lock

try {
    Atom::strategy('optimistic_transaction')->lock('week_report');
} catch (\AnourValar\LaravelAtom\Exceptions\OptimisticTransactionException $e) {
    // already in progress..
}

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages