Accounts show page

This commit is contained in:
benguozakinci@gmail.com
2021-08-04 17:51:44 +03:00
parent 986522e813
commit 77d6618368
5 changed files with 131 additions and 123 deletions

View File

@ -93,6 +93,41 @@ class Account extends Model
return $total;
}
/**
* Get the current balance.
*
* @return string
*/
public function getIncomeBalanceAttribute()
{
// Opening Balance
//$total = $this->opening_balance;
$total = 0;
// Sum Incomes
$total += $this->income_transactions->sum('amount');
return $total;
}
/**
* Get the current balance.
*
* @return string
*/
public function getExpenseBalanceAttribute()
{
// Opening Balance
//$total = $this->opening_balance;
$total = 0;
// Subtract Expenses
$total += $this->expense_transactions->sum('amount');
return $total;
}
/**
* Create a new factory instance for the model.
*