Added AccountType methods to get all types which are expediture or income.
This commit is contained in:
@@ -25,4 +25,31 @@ class AccountType extends Model
|
|||||||
{
|
{
|
||||||
return $this->accountClass->ioType();
|
return $this->accountClass->ioType();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Get all account types which are expeditures.
|
||||||
|
*
|
||||||
|
* @return Illuminate\Database\Eloquent\Collection
|
||||||
|
*/
|
||||||
|
public static function expeditures()
|
||||||
|
{
|
||||||
|
return AccountType::whereHas('accountClass', function ($query) {
|
||||||
|
$query->whereHas('ioType', function ($query) {
|
||||||
|
$query->where('i_o_types.name', 'Ausgabe');
|
||||||
|
});
|
||||||
|
})->get();
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Get all account types which are incomes.
|
||||||
|
*
|
||||||
|
* @return Illuminate\Database\Eloquent\Collection
|
||||||
|
*/
|
||||||
|
public static function incomes() {
|
||||||
|
return AccountType::whereHas('accountClass', function ($query) {
|
||||||
|
$query->whereHas('ioType', function ($query) {
|
||||||
|
$query->where('i_o_types.name', 'Einnahme');
|
||||||
|
});
|
||||||
|
})->get();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user