File tree Expand file tree Collapse file tree 2 files changed +44
-1
lines changed Expand file tree Collapse file tree 2 files changed +44
-1
lines changed Original file line number Diff line number Diff line change @@ -25,7 +25,7 @@ class User extends Model implements Wallet
2525```
2626
2727### Simple example
28- Find wallets and translate from one to another.
28+ Find wallets and exchange from one to another.
2929
3030``` php
3131$usd = $user->getWallet('usd');
Original file line number Diff line number Diff line change 1+ ## Laravel Wallet Swap
2+
3+ ## Composer
4+
5+ Рекомендуем установку используя [ Composer] ( https://getcomposer.org/ ) .
6+
7+ В корне вашего проекта запустите:
8+
9+ ``` bash
10+ composer req bavix/laravel-wallet-swap
11+ ```
12+
13+ ### Пользователь
14+ Для работы библиотеки нужны мульти-кошельки,
15+ поскольку транзакции будут между кошельками одного пользователя.
16+
17+ ``` php
18+ use Bavix\Wallet\Interfaces\Wallet;
19+ use Bavix\Wallet\Traits\HasWallets;
20+ use Bavix\Wallet\Traits\HasWallet;
21+
22+ class User extends Model implements Wallet
23+ {
24+ use HasWallet, HasWallets;
25+ }
26+ ```
27+
28+ ### Простой пример
29+ Находим кошельки пользователя и переводим с одного на другой.
30+
31+ ``` php
32+ $usd = $user->getWallet('usd');
33+ $rub = $user->getWallet('rub');
34+
35+ $usd->balance; // int(200)
36+ $rub->balance; // int(0)
37+
38+ $usd->exchange($rub, 10);
39+ $usd->balance; // int(190)
40+ $rub->balance; // int(622)
41+ ```
42+
43+ Это работает.
You can’t perform that action at this time.
0 commit comments