added more scopes
This commit is contained in:
@ -15,7 +15,7 @@ class ExpensesByCategory extends Widget
|
||||
|
||||
public function show()
|
||||
{
|
||||
Category::with('expense_transactions')->type('expense')->each(function ($category) {
|
||||
Category::with('expense_transactions')->expense()->each(function ($category) {
|
||||
$amount = 0;
|
||||
|
||||
$this->applyFilters($category->expense_transactions())->each(function ($transaction) use (&$amount) {
|
||||
|
@ -15,7 +15,7 @@ class IncomeByCategory extends Widget
|
||||
|
||||
public function show()
|
||||
{
|
||||
Category::with('income_transactions')->type('income')->each(function ($category) {
|
||||
Category::with('income_transactions')->income()->each(function ($category) {
|
||||
$amount = 0;
|
||||
|
||||
$this->applyFilters($category->income_transactions())->each(function ($transaction) use (&$amount) {
|
||||
|
@ -11,7 +11,7 @@ class LatestExpenses extends Widget
|
||||
|
||||
public function show()
|
||||
{
|
||||
$transactions = $this->applyFilters(Transaction::with('category')->type('expense')->orderBy('paid_at', 'desc')->isNotTransfer()->take(5))->get();
|
||||
$transactions = $this->applyFilters(Transaction::with('category')->expense()->orderBy('paid_at', 'desc')->isNotTransfer()->take(5))->get();
|
||||
|
||||
return $this->view('widgets.latest_expenses', [
|
||||
'transactions' => $transactions,
|
||||
|
@ -11,7 +11,7 @@ class LatestIncome extends Widget
|
||||
|
||||
public function show()
|
||||
{
|
||||
$transactions = $this->applyFilters(Transaction::with('category')->type('income')->orderBy('paid_at', 'desc')->isNotTransfer()->take(5))->get();
|
||||
$transactions = $this->applyFilters(Transaction::with('category')->income()->orderBy('paid_at', 'desc')->isNotTransfer()->take(5))->get();
|
||||
|
||||
return $this->view('widgets.latest_income', [
|
||||
'transactions' => $transactions,
|
||||
|
@ -18,7 +18,7 @@ class TotalExpenses extends Widget
|
||||
{
|
||||
$current = $open = $overdue = 0;
|
||||
|
||||
$this->applyFilters(Transaction::type('expense')->isNotTransfer())->each(function ($transaction) use (&$current) {
|
||||
$this->applyFilters(Transaction::expense()->isNotTransfer())->each(function ($transaction) use (&$current) {
|
||||
$current += $transaction->getAmountConvertedToDefault();
|
||||
});
|
||||
|
||||
|
@ -18,7 +18,7 @@ class TotalIncome extends Widget
|
||||
{
|
||||
$current = $open = $overdue = 0;
|
||||
|
||||
$this->applyFilters(Transaction::type('income')->isNotTransfer())->each(function ($transaction) use (&$current) {
|
||||
$this->applyFilters(Transaction::income()->isNotTransfer())->each(function ($transaction) use (&$current) {
|
||||
$current += $transaction->getAmountConvertedToDefault();
|
||||
});
|
||||
|
||||
|
Reference in New Issue
Block a user