Basic code for tracking liabilities.

This commit is contained in:
James Cole
2018-08-04 17:30:47 +02:00
parent f0d3ca5d53
commit 8dbc846314
17 changed files with 161 additions and 43 deletions

View File

@@ -168,6 +168,18 @@ class AccountRepository implements AccountRepositoryInterface
return $this->user->accounts()->find($accountId);
}
/**
* Return account type or null if not found.
*
* @param string $type
*
* @return AccountType|null
*/
public function getAccountTypeByType(string $type): ?AccountType
{
return AccountType::whereType($type)->first();
}
/**
* @param array $accountIds
*
@@ -373,6 +385,7 @@ class AccountRepository implements AccountRepositoryInterface
* Returns the date of the very first transaction in this account.
*
* @param Account $account
*
* @return TransactionJournal|null
*/
public function oldestJournal(Account $account): ?TransactionJournal

View File

@@ -24,17 +24,18 @@ namespace FireflyIII\Repositories\Account;
use Carbon\Carbon;
use FireflyIII\Models\Account;
use FireflyIII\Models\AccountType;
use FireflyIII\Models\TransactionJournal;
use FireflyIII\User;
use Illuminate\Support\Collection;
/**
* Interface AccountRepositoryInterface.
*/
interface AccountRepositoryInterface
{
/**
* Moved here from account CRUD.
*
@@ -87,6 +88,15 @@ interface AccountRepositoryInterface
*/
public function findNull(int $accountId): ?Account;
/**
* Return account type or null if not found.
*
* @param string $type
*
* @return AccountType|null
*/
public function getAccountTypeByType(string $type): ?AccountType;
/**
* @param array $accountIds
*
@@ -164,6 +174,7 @@ interface AccountRepositoryInterface
* Returns the date of the very first transaction in this account.
*
* @param Account $account
*
* @return TransactionJournal|null
*/
public function oldestJournal(Account $account): ?TransactionJournal;