mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Category information. #159
This commit is contained in:
@@ -153,6 +153,28 @@ class SingleCategoryRepository extends ComponentRepository implements SingleCate
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Category $category
|
||||
* @param Collection $accounts
|
||||
*
|
||||
* @param Carbon $start
|
||||
* @param Carbon $end
|
||||
*
|
||||
* @return Collection
|
||||
*/
|
||||
public function getJournalsForAccountsInRange(Category $category, Collection $accounts, Carbon $start, Carbon $end)
|
||||
{
|
||||
$ids = $accounts->pluck('id')->toArray();
|
||||
|
||||
return $category->transactionjournals()
|
||||
->after($start)
|
||||
->before($end)
|
||||
->expanded()
|
||||
->whereIn('source_account.id', $ids)
|
||||
->whereNotIn('destination_account.id', $ids)
|
||||
->get(TransactionJournal::QUERYFIELDS);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Category $category
|
||||
* @param int $page
|
||||
@@ -171,9 +193,6 @@ class SingleCategoryRepository extends ComponentRepository implements SingleCate
|
||||
->expanded()
|
||||
->take(50)
|
||||
->offset($offset)
|
||||
->orderBy('transaction_journals.date', 'DESC')
|
||||
->orderBy('transaction_journals.order', 'ASC')
|
||||
->orderBy('transaction_journals.id', 'DESC')
|
||||
->get(TransactionJournal::QUERYFIELDS);
|
||||
}
|
||||
|
||||
|
||||
@@ -79,6 +79,16 @@ interface SingleCategoryRepositoryInterface
|
||||
*/
|
||||
public function getJournals(Category $category, $page);
|
||||
|
||||
/**
|
||||
* @param Category $category
|
||||
* @param Collection $accounts
|
||||
*
|
||||
* @param Carbon $start
|
||||
* @param Carbon $end
|
||||
*
|
||||
* @return Collection
|
||||
*/
|
||||
public function getJournalsForAccountsInRange(Category $category, Collection $accounts, Carbon $start, Carbon $end);
|
||||
|
||||
/**
|
||||
* @param Category $category
|
||||
|
||||
Reference in New Issue
Block a user