From e7bb4a8ec6b69a6b1f2fab83bf12f49798465a08 Mon Sep 17 00:00:00 2001 From: Robert Horlings Date: Wed, 17 Feb 2016 10:17:16 +0100 Subject: [PATCH] Implemented option to specify pagesize when retrieving journals --- app/Repositories/Journal/JournalRepository.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/Repositories/Journal/JournalRepository.php b/app/Repositories/Journal/JournalRepository.php index 6184ff9d47..9de4c9785b 100644 --- a/app/Repositories/Journal/JournalRepository.php +++ b/app/Repositories/Journal/JournalRepository.php @@ -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; }