Skip to content

Commit

Permalink
fix attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
rez1dent3 committed Apr 27, 2022
1 parent 3d63158 commit d687933
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions src/Traits/MorphOneWallet.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit d687933

Please sign in to comment.