© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•13mo ago•
3 replies
Arjan

Problem: Exporter Not Working with Eager-Loaded Relationships

I’m trying to use a TitleExporter to export data from my Title model. Here’s the code for my exporter:

<?php

namespace App\Filament\Exports;

use App\Models\Title;
use Carbon\CarbonInterface;
use Filament\Actions\Exports\ExportColumn;
use Filament\Actions\Exports\Exporter;
use Filament\Actions\Exports\Models\Export;

class TitleExporter extends Exporter
{
    protected static ?string $model = Title::class;

    public static function getColumns(): array
    {
        return [
            ExportColumn::make('id')->label('Id'),
            ExportColumn::make('name')->label('Name'),
            ExportColumn::make('created_at')->label('Created at'),
            ExportColumn::make('updated_at')->label('Updated at'),
        ];
    }
}
<?php

namespace App\Filament\Exports;

use App\Models\Title;
use Carbon\CarbonInterface;
use Filament\Actions\Exports\ExportColumn;
use Filament\Actions\Exports\Exporter;
use Filament\Actions\Exports\Models\Export;

class TitleExporter extends Exporter
{
    protected static ?string $model = Title::class;

    public static function getColumns(): array
    {
        return [
            ExportColumn::make('id')->label('Id'),
            ExportColumn::make('name')->label('Name'),
            ExportColumn::make('created_at')->label('Created at'),
            ExportColumn::make('updated_at')->label('Updated at'),
        ];
    }
}


The Title model is configured to eagerly load some relationships using the protected $with property:

protected $with = ['metadata', 'metadata.parent', 'metadata.parent.metadata'];
protected $with = ['metadata', 'metadata.parent', 'metadata.parent.metadata'];


In the table, everything works perfectly: the metadata relationships are fetched and displayed without issues.

However, when I try to export, I get the following error:

Call to undefined relationship [metadata] on model [App\Models\Metadata].

It seems like the exporter isn’t able to handle the relationships defined in the $with property. Does anyone know why this might be happening or how I can fix it? Any advice is much appreciated! Thanks!
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

Eager loaded relationships filter
FilamentFFilament / ❓┊help
2y ago
Eager Loaded Pivot not working
FilamentFFilament / ❓┊help
3y ago
Using eager loaded relationships in custom table column views
FilamentFFilament / ❓┊help
2y ago
Eager loading relationships in table
FilamentFFilament / ❓┊help
2y ago