Avoid using model methods and use repository instead

This commit is contained in:
James Cole
2018-03-19 19:39:02 +01:00
parent aecffe10d9
commit 1645490f5c
8 changed files with 140 additions and 43 deletions

View File

@@ -125,6 +125,23 @@ class AccountRepository implements AccountRepositoryInterface
return $account->notes()->first();
}
/**
* Get note text or null.
*
* @param Account $account
*
* @return null|string
*/
public function getNoteText(Account $account): ?string
{
$note = $account->notes()->first();
if (is_null($note)) {
return null;
}
return $note->text;
}
/**
* Returns the amount of the opening balance for this account.
*
@@ -285,5 +302,4 @@ class AccountRepository implements AccountRepositoryInterface
return $journal;
}
}