diff --git a/packages/core/src/Base/Traits/HasModelExtending.php b/packages/core/src/Base/Traits/HasModelExtending.php index c0a0412d94..7cafe6c00d 100644 --- a/packages/core/src/Base/Traits/HasModelExtending.php +++ b/packages/core/src/Base/Traits/HasModelExtending.php @@ -47,6 +47,13 @@ public static function modelClass(): string return ModelManifest::get($contractClass) ?? static::class; } + /** + * Returns the model alias registered in the model relation morph map. + */ + public static function morphName():string{ + return (new (static::modelClass()))->getMorphClass(); + } + public function getMorphClass(): string { $morphMap = Relation::morphMap();