You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As you know, the package works with internal state. You can read more [here](https://github.com/bavix/laravel-wallet/pull/412) and [here](https://github.com/bavix/laravel-wallet/issues/455).
4
+
5
+
The action runs inside a transaction, which means you need to reset the transaction manually.
6
+
7
+
```php
8
+
use Illuminate\Support\Facades\DB;
9
+
10
+
public function handle(ActionFields $fields, Collection $models)
11
+
{
12
+
DB::rollBack(0);
13
+
...
14
+
}
15
+
```
16
+
17
+
Yes, it may not be convenient for someone, but you have to measure it. At the moment, there is no other solution.
18
+
19
+
But what if you want to use a transaction?
20
+
Use according to [documentation](transaction).
21
+
22
+
Why was the decision made to move away from embedded transactions?
23
+
The problem with embedded transactions is that the package changes the state of not only the database, but also the cache systems. Inside the transaction, sagas are implemented that update the balance in the cache systems of an already successful update inside the database.
24
+
This feature was well described by me in the [pull request](https://github.com/bavix/laravel-wallet/pull/412).
Copy file name to clipboardExpand all lines: docs/transaction.md
+2Lines changed: 2 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,7 @@
1
1
## Transaction
2
2
3
+
> Is it possible to use laravel's inline transactions? No, It is Immpossible. This limitation is due to the internal architecture of the package. To achieve the maximum speed of work, work with an internal state of balance was needed. Starting with version 8.2, a special error has appeared that will inform you about incorrect work with the `TransactionStartException` package.
4
+
3
5
Sometimes you need to execute many simple queries. You want to keep the data atomic. To do this, you need `laravel-wallet` v7.1+.
4
6
5
7
It is necessary to write off the amount from the balance and raise the ad in the search. What happens if the service for raising an ad fails? We wrote off the money, but did not raise the ad. Received reputational losses. We can imagine the opposite situation, we first raise the ad in the search, but it does not work to write off the money. There are not enough funds. This functionality will help to solve all this. We monitor ONLY the state of the wallet, the rest falls on the developer. Let's take an unsuccessful lift, for example.
0 commit comments