Skip to content

Commit

Permalink
Merge branch 'v4.0' into develop
Browse files Browse the repository at this point in the history
# Conflicts:
#	changelog.md
  • Loading branch information
rez1dent3 committed Mar 19, 2020
2 parents b6e6d9b + 1e2c561 commit c3f7c90
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 9 deletions.
14 changes: 12 additions & 2 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [5.0.1] - 2020-03-19
### Added
- Added a patch from version 4.2.1 #150

## [5.0.0] - 2020-03-13

### Added
Expand All @@ -22,6 +26,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- all deprecated methods are removed
- `nesbot/carbon` is no longer needed for the library to work

## [4.2.1] - 2020-03-19
### Fixed
- Fixed wallet recalculate command #150

## [4.2.0] - 2020-03-08

### Added
Expand Down Expand Up @@ -469,8 +477,10 @@ The operation is now executed in the transaction and updates the new `refund` fi
- Exceptions: AmountInvalid, BalanceIsEmpty.
- Models: Transfer, Transaction.

[Unreleased]: https://github.com/bavix/laravel-wallet/compare/5.0.0...develop
[5.0.0]: https://github.com/bavix/laravel-wallet/compare/4.2.0...5.0.0
[Unreleased]: https://github.com/bavix/laravel-wallet/compare/5.0.1...develop
[5.0.1]: https://github.com/bavix/laravel-wallet/compare/5.0.0...5.0.1
[5.0.0]: https://github.com/bavix/laravel-wallet/compare/4.2.1...5.0.0
[4.2.1]: https://github.com/bavix/laravel-wallet/compare/4.2.0...4.2.1
[4.2.0]: https://github.com/bavix/laravel-wallet/compare/4.1.2...4.2.0
[4.1.2]: https://github.com/bavix/laravel-wallet/compare/4.1.1...4.1.2
[4.1.1]: https://github.com/bavix/laravel-wallet/compare/4.1.0...4.1.1
Expand Down
14 changes: 7 additions & 7 deletions src/Commands/RefreshBalance.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,13 @@ class RefreshBalance extends Command
public function handle(): void
{
app(DbService::class)->transaction(function () {
$wallet = config('wallet.wallet.table', 'wallets');
app(DbService::class)
->connection()
->table($wallet)
->update(['balance' => 0]);

if (app(DbService::class)->connection() instanceof SQLiteConnection) {
$wallet = config('wallet.wallet.table', 'wallets');
app(DbService::class)
->connection()
->table($wallet)
->update(['balance' => 0]);

$this->sqliteUpdate();
} else {
$this->multiUpdate();
Expand Down Expand Up @@ -88,7 +88,7 @@ protected function multiUpdate(): void
->connection()
->table($wallet)
->joinSub($availableBalance, 'b', $joinClause, null, null, 'left')
->update(['balance' => app(DbService::class)->raw('b.balance')]);
->update(["$wallet.balance" => app(DbService::class)->raw('ifnull(b.balance, 0)')]);
}

}

0 comments on commit c3f7c90

Please sign in to comment.