Expand API for recurring transactions.

This commit is contained in:
James Cole
2018-12-07 20:20:54 +01:00
parent 8e4092e7d7
commit f0de469053
7 changed files with 165 additions and 13 deletions

View File

@@ -527,6 +527,22 @@ class TransactionCollector implements TransactionCollectorInterface
return $this;
}
/**
* @param array $journalIds
*
* @return TransactionCollectorInterface
*/
public function setJournalIds(array $journalIds): TransactionCollectorInterface
{
$this->query->where(
function (EloquentBuilder $q) use ($journalIds) {
$q->whereIn('transaction_journals.id', $journalIds);
}
);
return $this;
}
/**
* @param Collection $journals
*

View File

@@ -82,13 +82,6 @@ interface TransactionCollectorInterface
*/
public function count(): int;
/**
* Get all transactions.
*
* @return Collection
*/
public function getTransactions(): Collection;
/**
* Get a paginated result.
*
@@ -103,6 +96,13 @@ interface TransactionCollectorInterface
*/
public function getQuery(): EloquentBuilder;
/**
* Get all transactions.
*
* @return Collection
*/
public function getTransactions(): Collection;
/**
* Set to ignore the cache.
*
@@ -198,6 +198,15 @@ interface TransactionCollectorInterface
*/
public function setCategory(Category $category): TransactionCollectorInterface;
/**
* Set the journal IDs to filter on.
*
* @param array $journalIds
*
* @return TransactionCollectorInterface
*/
public function setJournalIds(array $journalIds): TransactionCollectorInterface;
/**
* Set the journals to filter on.
*