depsimon / laravel-wallet

A simple virtual wallet implementation for Laravel Users
MIT License
93 stars 57 forks source link

transactions() relation includes transactions that are not accepted #2

Closed chadtomkiss closed 6 years ago

chadtomkiss commented 6 years ago

Should $user->transactions() default to only include transactions that are accepted?

Similar to how Eloquent filters out soft deleted models, but you can use the withTrashed() to include ones that are deleted.

Maybe $user->transactions()->withRejected()->get() if you wanted every transaction or something?

depsimon commented 6 years ago

In all of my current use cases I'm always showing the list of all transactions. It's important for the clients & the admins to see the failed transactions as well otherwise it could confuse them.

chadtomkiss commented 6 years ago

That's cool.

I added a method to calculate a running balance next to each transaction, which is wrong due to including failed transactions but I will add a where clause to the transactions I am getting :+1: