This commit is contained in:
James Cole
2015-02-23 21:55:52 +01:00
parent 3e28c0c00a
commit 49066c282a
11 changed files with 482 additions and 26 deletions

View File

@@ -46,7 +46,6 @@ class AccountRepository implements AccountRepositoryInterface
public function getJournals(Account $account, $page, $range = 'session')
{
$offset = $page * 50;
$items = [];
$query = Auth::user()
->transactionJournals()
->withRelevantData()
@@ -58,14 +57,9 @@ class AccountRepository implements AccountRepositoryInterface
$query->before(Session::get('end', Carbon::now()->startOfMonth()));
$query->after(Session::get('start', Carbon::now()->startOfMonth()));
}
$count = $query->count();
$set = $query->take(50)->offset($offset)->get(['transaction_journals.*']);
foreach ($set as $entry) {
$items[] = $entry;
}
$paginator = new LengthAwarePaginator($items, $count, 50, $page);
$count = $query->count();
$set = $query->take(50)->offset($offset)->get(['transaction_journals.*']);
$paginator = new LengthAwarePaginator($set, $count, 50, $page);
return $paginator;

View File

@@ -54,12 +54,7 @@ class BudgetRepository implements BudgetRepositoryInterface
$set = $setQuery->get(['transaction_journals.*']);
$count = $countQuery->count();
$items = [];
foreach ($set as $entry) {
$items[] = $entry;
}
return new LengthAwarePaginator($items, $count, $take, $offset);
return new LengthAwarePaginator($set, $count, $take, $offset);
}
/**