Conditions | 2 |
Paths | 2 |
Total Lines | 12 |
Code Lines | 7 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 6 |
Changes | 0 |
1 | <?php |
||
47 | public function addBalance(Wallet $wallet, int $amount): bool |
||
48 | { |
||
49 | $newBalance = $wallet->getBalanceAttribute() + $amount; |
||
50 | $wallet->balance = $newBalance; |
||
|
|||
51 | |||
52 | if ($wallet->save()) { |
||
53 | $proxy = app(ProxyService::class); |
||
54 | $proxy->set($wallet->getKey(), $newBalance); |
||
55 | return true; |
||
56 | } |
||
57 | |||
58 | return false; |
||
59 | } |
||
62 |