illuminatech / balance Goto Github PK
View Code? Open in Web Editor NEWBalance accounting (bookkeeping) system based on debit and credit principle
License: Other
Balance accounting (bookkeeping) system based on debit and credit principle
License: Other
Can this package support multiple currencies?
Should I use the account type eg 'gbp:virtual-money'? Or add a column to both tables of currency, and modify the core logic to check ->where('currency', $currency) etc?
Q | A |
---|---|
This Package Version | 1.2.2 |
Laravel Framework Version | 8.8.0 |
PHP version | 7.3 |
Operating system | Windows |
\Illuminatech\Balance\Facades\Balance::increase($user->id, 100);
Balance increase
SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (tracking.backend
.balance_transactions
, CONSTRAINT balance_transactions_account_id_foreign
FOREIGN KEY (account_id
) REFERENCES balance_accounts
(id
) ON DELETE CASCADE ON UPDATE CASC) (SQL: insert into balance_transactions
(created_at
, amount
, account_id
) values (2020-08-28 11:45:47, 100, 1))
Code increase balance is
public function increase($account, $amount, $data = [])
{
$accountId = $this->fetchAccountId($account);
...
}
And if the variable account is an integer, then there is no automatic creation of an account if it does not exist
protected function fetchAccountId($idOrFilter)
{
if (is_array($idOrFilter)) {
$accountId = $this->findAccountId($idOrFilter);
if ($accountId === null) {
if ($this->autoCreateAccount) {
$accountId = $this->createAccount($idOrFilter);
} else {
throw new InvalidArgumentException('Unable to find account matching filter: ' . print_r($idOrFilter, true));
}
}
} else {
$accountId = $idOrFilter; // Here
}
return $accountId;
}
There are no methods for obtaining an account, where to get an ID from or how to create one.
Perhaps I did not understand something about how to use it correctly, thanks
Q | A |
---|---|
This Package Version | 1.1.1 |
Laravel Framework Version | 7.26.0 |
Is there support for Laravel 5.6
i created balance accounts through the seeder and I tried to increase their balance without artisan tinker
, I get returned a transaction ID but the table remains empty and the balance unchanged. I did it with the Balance facade and it's ::increase
method
seeing transactions in the database and balance changed
balance remains 0, transactions table auto-increment increments but no existing rows remain + balance doesn't get recalculated
Q | A |
---|---|
This Package Version | 1.3.0 |
Laravel Framework Version | 9.7.0 |
PHP version | 8.1 |
Operating system | Mac OS |
Increase to an account with:
Balance::increase(
[
'user_id' => 3,
'type' => 'virtual-money',
],
100
);
The below should equal 100, But it equals 0. I can see the database table shows 0.
echo $currentBalance = \DB::table('balance_accounts')
->select(['balance'])
->where(['id' => 1])
->value('balance');
0 balance on accounts.
Q | A |
---|---|
This Package Version | 1.2.2 |
Laravel Framework Version | 8.8.0 |
PHP version | 7.3 |
Operating system | Windows |
Put the balance increase call in between DB::beginTransaction();
and DB::commit();
Transaction is not committed until DB::commit();
is called and is rolled back when DB::rollBack();
is called.
The transaction is committed even if an exception is thrown.
Q | A |
---|---|
This Package Version | ^1.2 |
Laravel Framework Version | ^8.40 |
PHP version | 7.4.9 |
Operating system | Windows 10 |
Hello all,
How to use multiple balance service in 1 application?
For example:
Default is balance_accounts & balance_transactions during installation.
And I need to add another table like stock_accounts & stock_transactions and wanna use the same service.
Is it possible ?
Thank You.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.