Conditions | 1 |
Paths | 1 |
Total Lines | 11 |
Code Lines | 7 |
Lines | 0 |
Ratio | 0 % |
Tests | 8 |
CRAP Score | 1 |
Changes | 0 |
1 | <?php |
||
69 | 1 | public function calculateBalance(): bool |
|
70 | { |
||
71 | 1 | $balance = $this->holder->transactions() |
|
72 | 1 | ->where('wallet_id', $this->getKey()) |
|
73 | 1 | ->where('confirmed', true) |
|
74 | 1 | ->sum('amount'); |
|
75 | |||
76 | 1 | WalletProxy::set($this->getKey(), $balance); |
|
77 | 1 | $this->attributes['balance'] = $balance; |
|
78 | |||
79 | 1 | return $this->save(); |
|
80 | } |
||
91 |