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

@ -7,11 +7,12 @@ use Bkwld\Cloner\Cloneable;
use App\Traits\Contacts;
use App\Traits\Currencies;
use App\Traits\Media;
use App\Traits\Transactions;
use Illuminate\Notifications\Notifiable;
class Contact extends Model
{
use Cloneable, Contacts, Currencies, Media, Notifiable;
use Cloneable, Contacts, Currencies, Media, Notifiable, Transactions;
protected $table = 'contacts';
@ -41,12 +42,12 @@ class Contact 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()