composer require anourvalar/laravel-atom
Atom::onCommit(function () {
dispatch(new Job());
});
Atom::onRollBack(function () {
Storage::delete('file.jpg');
});
Atom::lock('user');
Atom::lockUser($user->id); // equals to: Atom::lock('user', $user->id);
try {
Atom::strategy('optimistic_transaction')->lock('week_report');
} catch (\AnourValar\LaravelAtom\Exceptions\OptimisticTransactionException $e) {
// already in progress..
}