added custom transaction types

This commit is contained in:
Denis Duliçi
2020-08-26 15:14:16 +03:00
parent d64917a3e0
commit 68f31b895f
11 changed files with 115 additions and 23 deletions

View File

@@ -3,9 +3,12 @@
namespace App\Models\Setting;
use App\Abstracts\Model;
use App\Traits\Transactions;
class Category extends Model
{
use Transactions;
protected $table = 'categories';
/**
@@ -29,12 +32,12 @@ class Category extends Model
public function expense_transactions()
{
return $this->transactions()->where('type', 'expense');
return $this->transactions()->whereIn('type', (array) $this->getExpenseTypes());
}
public function income_transactions()
{
return $this->transactions()->where('type', 'income');
return $this->transactions()->whereIn('type', (array) $this->getIncomeTypes());
}
public function invoices()