Skip to content

Commit

Permalink
Merge pull request #280 from wri/feat/TM-754-site-report-tree-totals
Browse files Browse the repository at this point in the history
[TM-754] Respect the filter query param on the tree species API
  • Loading branch information
roguenet authored Jun 12, 2024
2 parents 03d1862 + 060b95f commit 1b9c6a6
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
}

0 comments on commit 1b9c6a6

Please sign in to comment.