| Conditions | 1 |
| Paths | 1 |
| Total Lines | 11 |
| Code Lines | 7 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 2 |
| Changes | 0 | ||
| 1 | <?php |
||
| 57 | public function calculateBalance(): bool |
||
| 58 | { |
||
| 59 | $balance = $this->transactions() |
||
| 60 | ->where('wallet_id', $this->getKey()) |
||
| 61 | ->where('confirmed', true) |
||
| 62 | ->sum('amount'); |
||
| 63 | |||
| 64 | WalletProxy::set($this->getKey(), $balance); |
||
| 65 | $this->attributes['balance'] = $balance; |
||
| 66 | |||
| 67 | return $this->save(); |
||
| 68 | } |
||
| 79 |