© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•2y ago•
25 replies
Vp

How to eager load relationship inside infolist repeatable entry

I've enable prevent lazy loading like this in providers
Model::preventLazyLoading(! $this->app->isProduction());
Model::preventLazyLoading(! $this->app->isProduction());

I create a relationship manager and I display the data in infolist. but when it comes to repeatable entry like below example, I always got this error
Attempted to lazy load [customer] on model [App\Models\Reply] but lazy loading is disabled.
Attempted to lazy load [customer] on model [App\Models\Reply] but lazy loading is disabled.


protected static string $relationship = 'comments';

public function infolist(Infolist $infolist): Infolist
{
    return $infolist
        ->schema([
            // ...

            Infolists\Components\RepeatableEntry::make('replies')
                ->schema([
                    Infolists\Components\TextEntry::make('customer.name'),
                ]),
        ]);
}

// Comment model
public function replies(): HasMany
{
    return $this->hasMany(Reply::class);
}

// Reply model
public function customer(): BelongsTo
{
    return $this->belongsTo(Customer::class);
}
protected static string $relationship = 'comments';

public function infolist(Infolist $infolist): Infolist
{
    return $infolist
        ->schema([
            // ...

            Infolists\Components\RepeatableEntry::make('replies')
                ->schema([
                    Infolists\Components\TextEntry::make('customer.name'),
                ]),
        ]);
}

// Comment model
public function replies(): HasMany
{
    return $this->hasMany(Reply::class);
}

// Reply model
public function customer(): BelongsTo
{
    return $this->belongsTo(Customer::class);
}

I can put
protected $with = ['customer'];
protected $with = ['customer'];
inside Model, but it's not a great solution IMO, so what should be the best way to eager load the relationship
Solution
Yes, so helpful.. Now I use
->modifyQueryUsing()
->modifyQueryUsing()
and load relationship. it's working now, thanks
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

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

InfoList Repeatable Entry Eloquent Children
FilamentFFilament / ❓┊help
2y ago
how to eager load in relationship manager
FilamentFFilament / ❓┊help
3y ago
repeatable entry
FilamentFFilament / ❓┊help
13mo ago
repeatable entry
FilamentFFilament / ❓┊help
2y ago