© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•2y ago•
3 replies
Arjan

Call to a member function getRelationExistenceQuery() on null

I am using this filter:
SelectConstraint::make('parent.metadata.title')
                            ->options(fn() => Asset::whereHas('parent')->with('parent.metadata')->get()->pluck('parent.metadata.title', 'parent.metadata.title'))
                            ->multiple()
                            ->nullable()
                            ->label('Belongs to')
                            ->relationship('parent.metadata', 'title'),


public function parent(): MorphTo
    {
        return $this->morphTo('parent');
    }
SelectConstraint::make('parent.metadata.title')
                            ->options(fn() => Asset::whereHas('parent')->with('parent.metadata')->get()->pluck('parent.metadata.title', 'parent.metadata.title'))
                            ->multiple()
                            ->nullable()
                            ->label('Belongs to')
                            ->relationship('parent.metadata', 'title'),


public function parent(): MorphTo
    {
        return $this->morphTo('parent');
    }

the parent is a morphTo relation from Asset. The loading of options is executed normally. But then when I select an option I get the error 'Call to a member function getRelationExistenceQuery() on null'.

Parent morphs now to 2 different models. Strange thing is that if parent only uses (morphs to) 1 model there is NO error and everthing works correctly. PLEASE HELP!
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

Call to a member function getRelated() on null
FilamentFFilament / ❓┊help
5mo ago
Call to a member function makeGetUtility() on null
FilamentFFilament / ❓┊help
5mo ago
call to a member function relation() on null
FilamentFFilament / ❓┊help
10mo ago
Call to a member function isRelation() on null
FilamentFFilament / ❓┊help
11mo ago