diff --git a/src/Traits/MorphOneWallet.php b/src/Traits/MorphOneWallet.php index da91c6d4a..99fdcacd3 100644 --- a/src/Traits/MorphOneWallet.php +++ b/src/Traits/MorphOneWallet.php @@ -45,16 +45,12 @@ public function wallet(): MorphOne public function getWalletAttribute(): ?WalletModel { + /** @var WalletModel $wallet */ $wallet = $this->getRelationValue('wallet'); - if ($wallet === null) { - return null; - } - - assert($wallet instanceof WalletModel); if (!$wallet->relationLoaded('holder')) { $holder = app(CastServiceInterface::class)->getHolder($this); - $wallet->setRelation('holder', $holder); + $wallet->setRelation('holder', $holder->withoutRelations()); } return $wallet;