Expand collector to return single journals.

This commit is contained in:
James Cole 2018-02-16 16:43:48 +01:00
parent e89a77efb1
commit 45aa76afce
No known key found for this signature in database
GPG Key ID: C16961E655E74B5E
2 changed files with 24 additions and 0 deletions

View File

@ -488,6 +488,23 @@ class JournalCollector implements JournalCollectorInterface
return $this;
}
/**
* @param Collection $journals
*
* @return JournalCollectorInterface
*/
public function setJournals(Collection $journals): JournalCollectorInterface
{
$ids = $journals->pluck('id')->toArray();
$this->query->where(
function (EloquentBuilder $q) use ($ids) {
$q->whereIn('transaction_journals.id', $ids);
}
);
return $this;
}
/**
* @param int $limit
*

View File

@ -42,6 +42,13 @@ interface JournalCollectorInterface
*/
public function addFilter(string $filter): JournalCollectorInterface;
/**
* @param Collection $journals
*
* @return JournalCollectorInterface
*/
public function setJournals(Collection $journals): JournalCollectorInterface;
/**
* @param string $amount
*