[9.x] Allow for nullable morphs in whereNotMorphedTo

Merged
PA
4y ago
+7-7

This PR uses the null safe operator <=> instead of = to return results with a null polymorphic relationship as well as those not related with a polymorphic relationship. When this method was first introduced in #42264 (by me) null polymorphic relationships were ignored by whereNotMorphedTo and orWhereNotMorphedTo. This was on oversight on my behalf.

Thanks to @yngc0der for pointing this out.

For anyone using whereNotMorphedTo with nullable polymorphic relationships, you were getting incorrect results, here is the fix.