Skip to content

Commit c64ef5c

Browse files
authored
Merge pull request #1 from gkmk/gkmk-payments
Add payments relation on wallet
2 parents 923f182 + 30bacfc commit c64ef5c

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

src/Traits/HasWallet.php

+14
Original file line numberDiff line numberDiff line change
@@ -227,4 +227,18 @@ public function transfers(): HasMany
227227
->hasMany(config('wallet.transfer.model', Transfer::class), 'from_id')
228228
;
229229
}
230+
231+
/**
232+
* returns all the receiving transfers to this wallet.
233+
*
234+
* @return HasMany<Transfer>
235+
*/
236+
public function payments(): HasMany
237+
{
238+
/** @var Wallet $this */
239+
return app(CastServiceInterface::class)
240+
->getWallet($this, false)
241+
->hasMany(config('wallet.transfer.model', Transfer::class), 'to_id')
242+
;
243+
}
230244
}

0 commit comments

Comments
 (0)