Skip to content

Commit

Permalink
Merge pull request #127 from matthewjumpsoffbuildings/1.2
Browse files Browse the repository at this point in the history
Use Group clause in ExportLensActionRequest to allow for aggregate Lens exports
  • Loading branch information
patrickbrouwers authored Oct 11, 2021
2 parents 2219283 + 3791eec commit 3641b8b
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/Requests/ExportLensActionRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,11 @@ class ExportLensActionRequest extends LensActionRequest implements ExportActionR
public function toExportQuery()
{
return $this->toQuery()->when(!$this->forAllMatchingResources(), function ($query) {
$query->whereKey(explode(',', $this->resources));
$groups = $query->getQuery()->groups;

is_array($groups) && 1 === count($groups)
? $query->whereIn($groups[0], explode(',', $this->resources))
: $query->whereKey(explode(',', $this->resources));
});
}

Expand Down

0 comments on commit 3641b8b

Please sign in to comment.