From cf655000af3d31e85142c2dbee528328e0ec3ac2 Mon Sep 17 00:00:00 2001 From: Goh Keat Liang Date: Fri, 17 Jun 2022 14:09:04 +0800 Subject: [PATCH 1/2] Fix laravel-ide-helper generate:model https://github.com/bavix/laravel-wallet/issues/516 --- src/Traits/HasWallet.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Traits/HasWallet.php b/src/Traits/HasWallet.php index bb6ba9a28..28db745ba 100644 --- a/src/Traits/HasWallet.php +++ b/src/Traits/HasWallet.php @@ -81,7 +81,7 @@ public function getBalanceIntAttribute(): int public function walletTransactions(): HasMany { return app(CastServiceInterface::class) - ->getWallet($this) + ->getWallet($this, !is_null($this->id)) ->hasMany(config('wallet.transaction.model', Transaction::class), 'wallet_id') ; } From 807722899a1dea3b50d95d3aa374a51ed6c65d90 Mon Sep 17 00:00:00 2001 From: Goh Keat Liang Date: Sat, 18 Jun 2022 13:49:05 +0800 Subject: [PATCH 2/2] Fix based on suggested https://github.com/bavix/laravel-wallet/pull/517#discussion_r900114206 --- src/Traits/HasWallet.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Traits/HasWallet.php b/src/Traits/HasWallet.php index 28db745ba..316d8caa6 100644 --- a/src/Traits/HasWallet.php +++ b/src/Traits/HasWallet.php @@ -81,7 +81,7 @@ public function getBalanceIntAttribute(): int public function walletTransactions(): HasMany { return app(CastServiceInterface::class) - ->getWallet($this, !is_null($this->id)) + ->getWallet($this, false) ->hasMany(config('wallet.transaction.model', Transaction::class), 'wallet_id') ; }