© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•2y ago•
18 replies
Renan Pereira

Export Column State Not Working

Hi guys,
I have a boolean column in a relationship model and I want to personalize it so true means yes and false means no, however it's not customizing by state on the Exporter class. I'm getting 1 or 0 with or without state, is this a bug or am I doing something wrong?

public static function getColumns(): array
    {
        return [        
            ExportColumn::make('docto.obrigatorio')
                ->label('Obrigatório')
                ->state(function (EmpresaDocto $record) {
                    if ($record->docto->obrigatorio === 1) {
                        return 'Sim';
                    }

                    return 'Não';
                }),
        ];
    }
public static function getColumns(): array
    {
        return [        
            ExportColumn::make('docto.obrigatorio')
                ->label('Obrigatório')
                ->state(function (EmpresaDocto $record) {
                    if ($record->docto->obrigatorio === 1) {
                        return 'Sim';
                    }

                    return 'Não';
                }),
        ];
    }
Solution
->formatStateUsing(fn ($state): string => $state === 1 ? 'Sim' : 'Não')
->formatStateUsing(fn ($state): string => $state === 1 ? 'Sim' : 'Não')
Jump to solution
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307Members
Resources
Was this page helpful?

Similar Threads

Recent Announcements

Similar Threads

Export not working
FilamentFFilament / ❓┊help
2y ago
export format column
FilamentFFilament / ❓┊help
2y ago
Custom column export
FilamentFFilament / ❓┊help
3y ago
Hide Column From Export
FilamentFFilament / ❓┊help
2y ago