As per issue #90 - when using an export query that is not forAllMatchingResources, the default behaviour was to use the Laravel withKey which selects the primary key (usually id) of the Resource in question, disregarded the key of the Lens for that resource (which may be an aggregate lens using COUNT() and GROUP BY SQL)
The solution is to check for a groups clause in the Lenses underlying query builder, and if it exists, to use that with a whereIn() instead
As per issue #90 - when using an export query that is not
forAllMatchingResources
, the default behaviour was to use the LaravelwithKey
which selects the primary key (usuallyid
) of the Resource in question, disregarded the key of the Lens for that resource (which may be an aggregate lens usingCOUNT()
andGROUP BY
SQL)The solution is to check for a
groups
clause in the Lenses underlying query builder, and if it exists, to use that with awhereIn()
instead