Skip to content

Conversation

pelmered
Copy link
Contributor

@pelmered pelmered commented Feb 6, 2024

If you define morph maps for the model that you add comments for it will not work.
This is because you use use getMorphClass() to translate the namespaced model name into the mapped name here, but when you query the database for comments you use static::class

So if you for example have this:

Relation::morphMap([
   'user'           => \App\Models\User::class,
]);

you will insert 'user' into the subject_type column, but then you would use App\Models\User in the query.

With this fix, you will use 'user' in the query as well.

@luke-parallax luke-parallax merged commit b03c0da into parallax:main Feb 13, 2024
@luke-parallax
Copy link
Collaborator

Thanks @pelmered! 🙌

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants