Fix issue #637 with cash accounts.

This commit is contained in:
James Cole
2017-05-07 19:45:40 +02:00
parent 5fb73bdb01
commit 17fb6983d8
4 changed files with 55 additions and 5 deletions

View File

@@ -250,6 +250,19 @@ class AccountRepository implements AccountRepositoryInterface
return $result;
}
/**
* @return Account
*/
public function getCashAccount(): Account
{
$type = AccountType::where('type', AccountType::CASH)->first();
$account = Account::firstOrCreateEncrypted(
['user_id' => $this->user->id, 'account_type_id' => $type->id, 'name' => 'Cash account', 'active' => 1]
);
return $account;
}
/**
* Returns the date of the very last transaction in this account.
*