Comments (1)
Well there are several options, but nothing this packages provides out of the box.
You need to build a cumulative sum. Actually I have once made a view like show have shown in my own app and I calculated the resulting balance in the frontend starting at the current balance and calculate backwards.
But you could also do this with a database subquery that sums up all amounts of the previous transaction for each row. It needs some tinkering to get it work (especially with laravel syntax) and then you would need check if the performance is acceptable. You might need additional indexes etc. But if you manage to get a setup like this working, this would be the preferable way.
I don't have time to tinker with myself, but it is really an interesting task to solve in a neat way.
from laravel-wallet.
Related Issues (15)
- Crossgrading from depsimon/laravel-wallet into Laravel 8 HOT 1
- optimist or pesimist transaction HOT 3
- Atomic update on Wallet balance HOT 2
- deposit with negative value - will update balance
- Class 'Wallet' not found HOT 1
- References to auto_recalculate_balance config value are missing wallet -prefix
- Endless balance calculation when balance auto recalculation is enabled and wallet type is decimal HOT 2
- Move Transaction Functions From HasWallet Trait To Wallet Model
- Save Amount With Algebraic Sign
- Wrong Total Amount When Children Are Soft-Deleted
- How to implement multiple wallets for a user HOT 2
- Use Result Caching Instead of Storing the Balance on the Wallet Table
- walletTransactions HOT 1
- this package is useful
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from laravel-wallet.