Export action to display data from relationships
Hi.. I have follow the documentation to display data from relation for the Export action (https://filamentphp.com/docs/3.x/actions/prebuilt-actions/export#displaying-data-from-relationships).
The problem is whe I use
ExportColumn::make('gender.name')
, the relation value is not showing.
but if I just use the gender relationship ExportColumn::make('gender')
the whole relation value are show {"id":2,"name":"Female","created_at":"2024-02-08T04:18:13.000000Z","updated_at":"2024-02-08T04:18:13.000000Z","deleted_at":null}
I'm using filament 3.2. Here is my code. What is missing here?
UserExporter.php
User.php
Gender.php
I'm using filament 3.2. Here is my code. What is missing here?Solution:Jump to solution
Have you tried updating Filament to latest version? There was a bug in early versions of 3.2 which caused relation data not to show up in export at all.
3 Replies
Solution
Have you tried updating Filament to latest version? There was a bug in early versions of 3.2 which caused relation data not to show up in export at all.
Yeah, please run php artisan:about too
yes, you are correct.. previously mine was v3.2.0. After I updated to v3.2.28, everything work as expected. Thank for point it out