bavix / laravel-wallet

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

how insert from table transfers , have column fee = 10 #64

Closed khanhnam99 closed 5 years ago

khanhnam99 commented 5 years ago

how insert from table transfers , have column fee = 10?

rez1dent3 commented 5 years ago

Give me more data. Nothing is clear.

khanhnam99 commented 5 years ago

$first = User::first(); $last = User::orderBy('id', 'desc')->first(); // last user $first->getKey() !== $last->getKey(); // true

$first->transfer($last, 5); $first->balance; // int(95) $last->balance; // int(5)

how add fee = 10 in $first->transfer($last, 5)

khanhnam99 commented 5 years ago

how use function fee() Capture

rez1dent3 commented 5 years ago

@khanhnam99 Taxes, commissions, I did not describe in the documentation. But you can learn an example from unit tests. https://github.com/bavix/laravel-wallet/blob/master/tests/TaxTest.php

Model Item: https://github.com/bavix/laravel-wallet/blob/master/tests/Models/ItemTax.php

rez1dent3 commented 5 years ago

The tax consists of a percentage and there is no minimum payment. That is, to set a commission of 10 will not work.

khanhnam99 commented 5 years ago

thanks

rez1dent3 commented 5 years ago

@khanhnam99 in the next version I will add the ability to fix the minimum fee.

the interface will be like this: https://github.com/bavix/laravel-wallet/blob/3.1/src/Interfaces/MinimalTaxable.php#L10

Here is an example of working from a unit test. https://github.com/bavix/laravel-wallet/blob/3.1/tests/MinTaxTest.php

PS, Version 3.1 is in development and is not stable. Do not use in production.