bavix / laravel-wallet

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

How to Insert new column to transaction table #178

Closed mayuriOAB closed 4 years ago

mayuriOAB commented 4 years ago

I want to insert new column to transaction table to maintain my operations. What are the steps. Also how can I insert values to newly added column at the time of deposit.

rez1dent3 commented 4 years ago

Hello, @mayuriOAB

You can do it like this: https://github.com/bavix/laravel-wallet/blob/4a597d72abe434afc81ef8690ef1ddf0a4cd6bac/tests/WalletExtensionTest.php#L25-L37

https://github.com/bavix/laravel-wallet/blob/4a597d72abe434afc81ef8690ef1ddf0a4cd6bac/tests/Common/Models/Transaction.php#L16-L21

https://github.com/bavix/laravel-wallet/blob/4a597d72abe434afc81ef8690ef1ddf0a4cd6bac/tests/migrations/2019_09_19_191432_alter_column_transaction_table.php#L17-L19

But changing the structure, be more careful when updating. I would indicate the library version hard.

mayuriOAB commented 4 years ago

okay. I want to add column as integer. I added as you suggested. But how can I use them. I am trying $user->deposit(100, ['state' => 'QUEUED'], ['purpose' => $purpose]); I have added state as new column and next array for meta field. can you please help me to insert or update this while deposit and withdraw

rez1dent3 commented 4 years ago

@mayuriOAB Did you bind the operation? https://github.com/bavix/laravel-wallet/blob/4a597d72abe434afc81ef8690ef1ddf0a4cd6bac/tests/WalletExtensionTest.php#L19

rez1dent3 commented 4 years ago

No more questions. I am closing the issue. There will be questions - reopen or create a new one.