Issue with Table Joins in Exports
Hi everyone,
I'm encountering an issue when working with Filament's
Here’s an example of my
I’ve added the column to the export like this:
But when I export, the
What I noticed:
I’d appreciate any advice or insight on how to resolve this!
I'm encountering an issue when working with Filament's
modifyQuery method for Exports. Specifically, when I try to include table joins or additional query logic (e.g., grouping or calculated columns), the export doesn’t seem to reflect the expected data.Here’s an example of my
modifyQuery implementation:I’ve added the column to the export like this:
But when I export, the
created_by_name column isn’t filled at all. For additional debugging, I added the following:What I noticed:
- The
$recordobject only includes data directly from the model/table (e.g.,holds), and none of the computed or joined columns (created_by_name) are present. - It seems like the export is only pulling fields defined in the model, ignoring any additional columns from the query.
- The same logic works perfectly in a Resource table using
getEloquentQuery, although this doesn't transfer to the export. - It seems that the
modifyQuerymethod doesn’t affect what data is passed to the export columns.
modifyQuery interacts with exports? Or am I missing something about how to include computed/joined columns in export data? I’d appreciate any advice or insight on how to resolve this!