MorphMany Relations not (yet) supported in V3 relationshipManager?
Hey!
TL/DR
The docs state
These are compatible with HasMany, HasManyThrough, BelongsToMany, MorphMany and MorphToMany relationships.
on https://filamentphp.com/docs/3.x/panels/resources/relation-managers#relation-managers---interactive-tables-underneath-your-resource-forms but when creating a RelationManager for a morphed relation, I receive App\Models\Product::logs(): Return value must be of type Illuminate\Database\Eloquent\Relations\HasMany, Illuminate\Database\Eloquent\Relations\MorphMany returned
Detailed example
I have a Model Product
, which has its own ProductRessource
and a model History
. In my History I have:
and in my Product
I have
In my LogRelationManager
I added
But when opening my ProductResource
, I receive
App\Models\Product::logs(): Return value must be of type Illuminate\Database\Eloquent\Relations\HasMany, Illuminate\Database\Eloquent\Relations\MorphMany returned
1 Reply
Solution
Oops. I'm stupid. It was my own typehint :x