F
Filament3mo ago
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!
0 Replies
No replies yetBe the first to reply to this messageJoin