-
-
Notifications
You must be signed in to change notification settings - Fork 233
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Extending transaction model #201
Comments
Hello @smtlab. You can add the required columns to the database yourself. Someone asked me already like this.. Migrating a table: laravel-wallet/tests/migrations/2019_09_19_191432_alter_column_transaction_table.php Lines 17 to 19 in 1c26faf
Adding data on insertion: laravel-wallet/tests/Objects/Operation.php Lines 3 to 18 in 1c26faf
Overriding the transaction record object:
And now we write data to the database: laravel-wallet/tests/WalletExtensionTest.php Lines 31 to 36 in 1c26faf
For convenience, you can override the Transaction model: laravel-wallet/tests/TestCase.php Line 68 in 1c26faf
Nothing else is needed. The complete code is available here, here and here))) |
@rez1dent3 Thanks for giving a detailed explanation, really appreciate your time :) I completely missed the config file, I see I can override all services and models. |
@smtlab can you please share your logic for expiry logic here? |
Hi @rez1dent3 Thank you soo much for providing such a great package. |
@nagsamayam Hello. I don't check old issue, I found your question by accident. If you want to discuss in more detail, then create a new issue. Yes, Operation no longer exists, but it is still possible to implement this functionality. An example is in unit tests:
|
Hi @rez1dent3 |
Hey @rez1dent3
Can you suggest to me how should I go about the below use case?
I am working on the logistics app, where I have shipments from multiple customers.
Every customer has cod-wallet
I have to deposit Cash on delivery amount from shipments to cod-wallet.
The problem here is there is a background service which picks up unpaid shipments from DB and processes deposit, also I cannot maintain any flag in shipment model for paid status as it would not be reliable, I directly want to join with
transactions
table and check if the entry exists with typedeposit
for a shipment.Unfortunately, the transaction only takes metadata from the user side, using the JSON column I cannot take advantage of joins.
My thoughts on giving developers the flexibility to customize model
morphTo
relation in the transaction model for developers to extend according to their requirements and allow developers to pass transaction class while doing transactions.Any suggestions would really help.
Thanks in advance
The text was updated successfully, but these errors were encountered: