diff --git a/app/Http/Controllers/V2/TreeSpecies/GetTreeSpeciesForEntityController.php b/app/Http/Controllers/V2/TreeSpecies/GetTreeSpeciesForEntityController.php index 26f621b49..0811786c3 100644 --- a/app/Http/Controllers/V2/TreeSpecies/GetTreeSpeciesForEntityController.php +++ b/app/Http/Controllers/V2/TreeSpecies/GetTreeSpeciesForEntityController.php @@ -18,6 +18,11 @@ public function __invoke(Request $request, EntityModel $entity) ->where('speciesable_type', get_class($entity)) ->where('speciesable_id', $entity->id); + $filter = $request->query('filter'); + if (! empty($filter['collection'])) { + $query->where('collection', $filter['collection']); + } + return new TreeSpeciesCollection($query->paginate()); } }