Expanded on categories.

This commit is contained in:
James Cole
2014-11-14 11:56:45 +01:00
parent 9adbbd872c
commit eb8f8fa935
5 changed files with 30 additions and 14 deletions

View File

@@ -170,6 +170,20 @@ class Category implements CUD, CommonDatabaseCalls, CategoryInterface
throw new NotImplementedException;
}
public function getTransactionJournals(\Category $category, $limit = 50)
{
$offset = intval(\Input::get('page')) > 0 ? intval(\Input::get('page')) * $limit : 0;
$set = $category->transactionJournals()->withRelevantData()->take($limit)->offset($offset)->orderBy('date', 'DESC')->get(['transaction_journals.*']);
$count = $category->transactionJournals()->count();
$items = [];
foreach ($set as $entry) {
$items[] = $entry;
}
return \Paginator::make($items, $count, $limit);
}
/**
* @param \Category $budget
* @param Carbon $date