Skip to content

Commit b7712f7

Browse files
authored
Update Transfer.php Model
Update Transfer model to support dynamic loading of overwritten Wallet or Transaction model classes. Defaults to current Wallet and Transaction model from inside the package if no overwritten models specified. Signed-off-by: George Klincarski <[email protected]>
1 parent fff328f commit b7712f7

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/Models/Transfer.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,30 +81,30 @@ public function getTable(): string
8181
*/
8282
public function from(): BelongsTo
8383
{
84-
return $this->belongsTo(Wallet::class, 'from_id');
84+
return $this->belongsTo(config('wallet.wallet.model', Wallet::class), 'from_id');
8585
}
8686

8787
/**
8888
* @return BelongsTo<Wallet, self>
8989
*/
9090
public function to(): BelongsTo
9191
{
92-
return $this->belongsTo(Wallet::class, 'to_id');
92+
return $this->belongsTo(config('wallet.wallet.model', Wallet::class), 'to_id');
9393
}
9494

9595
/**
9696
* @return BelongsTo<Transaction, self>
9797
*/
9898
public function deposit(): BelongsTo
9999
{
100-
return $this->belongsTo(Transaction::class, 'deposit_id');
100+
return $this->belongsTo(config('wallet.transaction.model', Transaction::class), 'deposit_id');
101101
}
102102

103103
/**
104104
* @return BelongsTo<Transaction, self>
105105
*/
106106
public function withdraw(): BelongsTo
107107
{
108-
return $this->belongsTo(Transaction::class, 'withdraw_id');
108+
return $this->belongsTo(config('wallet.transaction.model', Transaction::class), 'withdraw_id');
109109
}
110110
}

0 commit comments

Comments
 (0)