protected function getRelationMappedMorphType($class)
    {
        $map = Relation::morphMap();

        if (empty($map)) {
            return ltrim($class, '\\');
        }

        if (    false !== ($type = array_search($class, $map))
            ||  false !== ($type = array_search(ltrim($class, '\\'), $map))
        ) {
            return $type;
        }

        return trim($class, '\\');
    }