Implemented option to specify pagesize when retrieving journals

This commit is contained in:
Robert Horlings 2016-02-17 10:17:16 +01:00
parent 17dad27610
commit e7bb4a8ec6

View File

@ -92,9 +92,9 @@ class JournalRepository implements JournalRepositoryInterface
*
* @return LengthAwarePaginator
*/
public function getJournalsOfTypes(array $types, int $offset, int $page)
public function getJournalsOfTypes(array $types, int $offset, int $page, int $pagesize = 50)
{
$set = Auth::user()->transactionJournals()->transactionTypes($types)->withRelevantData()->take(50)->offset($offset)
$set = Auth::user()->transactionJournals()->transactionTypes($types)->withRelevantData()->take($pagesize)->offset($offset)
->orderBy('date', 'DESC')
->orderBy('order', 'ASC')
->orderBy('id', 'DESC')
@ -102,7 +102,7 @@ class JournalRepository implements JournalRepositoryInterface
['transaction_journals.*']
);
$count = Auth::user()->transactionJournals()->transactionTypes($types)->count();
$journals = new LengthAwarePaginator($set, $count, 50, $page);
$journals = new LengthAwarePaginator($set, $count, $pagesize, $page);
return $journals;
}