This commit is contained in:
James Cole
2017-08-15 17:34:34 +02:00
parent 34894fb76b
commit 7b3ef0e3ab
5 changed files with 125 additions and 61 deletions

View File

@@ -205,10 +205,12 @@ trait FindAccountsTrait
*/
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]
$type = AccountType::where('type', AccountType::CASH)->first();
$account = Account::firstOrCreateEncrypted(
['user_id' => $this->user->id, 'account_type_id' => $type->id, 'name' => 'Cash account']
);
$account->active = true;
$account->save();
return $account;
}