Move collecting journals to the collector.

This commit is contained in:
James Cole
2016-11-05 11:44:41 +01:00
parent 43afdb021a
commit 8e542531b3
6 changed files with 23 additions and 47 deletions

View File

@@ -252,30 +252,6 @@ class BillRepository implements BillRepositoryInterface
return $sum;
}
/**
* This method also returns the amount of the journal in "journalAmount"
* for easy access.
*
* @param Bill $bill
*
* @param int $page
* @param int $pageSize
*
* @return LengthAwarePaginator|Collection
*/
public function getJournals(Bill $bill, int $page, int $pageSize = 50): LengthAwarePaginator
{
$offset = ($page - 1) * $pageSize;
$query = $bill->transactionJournals()
->expanded()
->sortCorrectly();
$count = $query->count();
$set = $query->take($pageSize)->offset($offset)->get(TransactionJournal::queryFields());
$paginator = new LengthAwarePaginator($set, $count, $pageSize, $page);
return $paginator;
}
/**
* @param Bill $bill
*