mirror of
				https://github.com/firefly-iii/firefly-iii.git
				synced 2025-10-31 02:36:28 +00:00 
			
		
		
		
	Add start and end data to the available_budget list endpoint API
This commit is contained in:
		| @@ -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); | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user