bavix / laravel-wallet

It's easy to work with a virtual wallet
https://bavix.github.io/laravel-wallet/
MIT License
1.14k stars 230 forks source link

[Warning] Infinity loop when use traits HasWallet #805

Closed nvchungdl closed 11 months ago

nvchungdl commented 11 months ago

Describe the bug Infinity loop when use traits HasWallet with model already have column "balance" in table

To Reproduce Steps to reproduce the behavior:

  1. create table users with column: balance
  2. implement HasWallet to model User
  3. return User::find(1000000);
Screenshot 2023-11-21 at 16 32 56
rez1dent3 commented 11 months ago

Hello. This is not a bug, but expected behavior. The balance column is declared in HasWallet: https://github.com/bavix/laravel-wallet/blob/18448234e9af73fdf31bd9a5ca9a26fd34e56eca/src/Traits/HasWallet.php#L64

You need to use the multi-wallet functionality (HasWallets trait). HasWallet is not suitable for your case.