Skip to content
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

Add a relation for fetching transactions from the wallet (walletTransactions) #418

Merged
merged 2 commits into from
Dec 7, 2021

Conversation

rez1dent3
Copy link
Member

@rez1dent3 rez1dent3 commented Dec 7, 2021

#416

// default wallet
$user->deposit(100);
$user->wallet->deposit(200);
$user->wallet->withdraw(1);

// usd
$usd = $user->createWallet(['name' => 'USD']);
$usd->deposit(100);

// eur
$eur = $user->createWallet(['name' => 'EUR']);
$eur->deposit(100);

$user->transactions()->count(); // 5
$user->wallet->transactions()->count(); // 5
$usd->transactions()->count(); // 5
$eur->transactions()->count(); // 5
// the transactions method returns data relative to the owner of the wallet, for all transactions

$user->walletTransactions()->count(); // 3. we get the default wallet
$user->wallet->walletTransactions()->count(); // 3
$usd->walletTransactions()->count(); // 1
$eur->walletTransactions()->count(); // 1

@rez1dent3 rez1dent3 added enhancement New feature or request 7.x-dev labels Dec 7, 2021
@rez1dent3 rez1dent3 self-assigned this Dec 7, 2021
@rez1dent3 rez1dent3 merged commit 798dd98 into creation Dec 7, 2021
@rez1dent3 rez1dent3 deleted the transwallet branch December 8, 2021 06:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
7.x-dev enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant