mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-01-03 20:57:19 -06:00
Add start and end data to the available_budget list endpoint API
This commit is contained in:
parent
d0d73c5e3e
commit
d33c89a8ee
@ -104,6 +104,17 @@ class AvailableBudgetController extends Controller
|
||||
|
||||
// get list of available budgets. Count it and split it.
|
||||
$collection = $this->repository->getAvailableBudgets();
|
||||
|
||||
// filter list on start and end date, if present.
|
||||
// TODO: put this in the query.
|
||||
$start = $this->parameters->get('start');
|
||||
$end = $this->parameters->get('end');
|
||||
if(null !== $start && null !== $end) {
|
||||
$collection = $collection->filter(function(AvailableBudget $availableBudget) use ($start, $end) {
|
||||
return $availableBudget->start_date->gte($start) && $availableBudget->end_date->lte($end);
|
||||
});
|
||||
}
|
||||
|
||||
$count = $collection->count();
|
||||
$availableBudgets = $collection->slice(($this->parameters->get('page') - 1) * $pageSize, $pageSize);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user