© 2026 Hedgehog Software, LLC

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

Table ExportAction failing on relationship

Whenever I try to export a table and add a relationship column with the dot notation the job fails, however no error is displayed

Here is my code, the relationship is BelongsTo Funcionario, if I use funcionario_id it works but with funcionario.nome the job fails.

class EntradaExporter extends Exporter
{
    protected static ?string $model = Entrada::class;

    public static function getColumns(): array
    {
        return [
            ExportColumn::make('id')
                ->label('ID'),
            ExportColumn::make('funcionario.nome'),
            ExportColumn::make('obra_id'),
            ExportColumn::make('dt_entrada'),
            ExportColumn::make('created_at'),
            ExportColumn::make('updated_at'),
            ExportColumn::make('deleted_at'),
            ExportColumn::make('dt_saida'),
            ExportColumn::make('created_by'),
            ExportColumn::make('updated_by'),
            ExportColumn::make('deleted_by'),
        ];
    }

    public static function getCompletedNotificationBody(Export $export): string
    {
        $body = 'Your entrada export has completed and ' . number_format($export->successful_rows) . ' ' . str('row')->plural($export->successful_rows) . ' exported.';

        if ($failedRowsCount = $export->getFailedRowsCount()) {
            $body .= ' ' . number_format($failedRowsCount) . ' ' . str('row')->plural($failedRowsCount) . ' failed to export.';
        }

        return $body;
    }
}
class EntradaExporter extends Exporter
{
    protected static ?string $model = Entrada::class;

    public static function getColumns(): array
    {
        return [
            ExportColumn::make('id')
                ->label('ID'),
            ExportColumn::make('funcionario.nome'),
            ExportColumn::make('obra_id'),
            ExportColumn::make('dt_entrada'),
            ExportColumn::make('created_at'),
            ExportColumn::make('updated_at'),
            ExportColumn::make('deleted_at'),
            ExportColumn::make('dt_saida'),
            ExportColumn::make('created_by'),
            ExportColumn::make('updated_by'),
            ExportColumn::make('deleted_by'),
        ];
    }

    public static function getCompletedNotificationBody(Export $export): string
    {
        $body = 'Your entrada export has completed and ' . number_format($export->successful_rows) . ' ' . str('row')->plural($export->successful_rows) . ' exported.';

        if ($failedRowsCount = $export->getFailedRowsCount()) {
            $body .= ' ' . number_format($failedRowsCount) . ' ' . str('row')->plural($failedRowsCount) . ' failed to export.';
        }

        return $body;
    }
}
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Issue with ExportAction on table with defaultSort() on a relationship attribute
FilamentFFilament / ❓┊help
2y ago
ExportAction on Row to export another model with HasMany relationship
FilamentFFilament / ❓┊help
2y ago
Help on table eloquent relationship
FilamentFFilament / ❓┊help
2y ago
Display relationship on table column
FilamentFFilament / ❓┊help
3y ago