Fixed MorphTo Model class namespace

This commit is contained in:
weskiller 2020-06-30 21:31:28 +08:00
parent c191287c54
commit b776ca8fc2

View File

@ -275,7 +275,7 @@ class ModelUpdateVisitor extends NodeVisitorAbstract
if (array_key_exists($name, self::RELATION_METHODS)) {
if ($name === 'morphTo') {
// Model isn't specified because relation is polymorphic
$this->setProperty($method->getName(), [Model::class], true);
$this->setProperty($method->getName(), ['\\' . Model::class], true);
}
else if ($expr->args[0]->value instanceof Node\Expr\ClassConstFetch) {
$related = $expr->args[0]->value->class->toCodeString();