diff --git a/src/Fields/MorphTo.php b/src/Fields/MorphTo.php index 2a22868f..0e53a1a9 100644 --- a/src/Fields/MorphTo.php +++ b/src/Fields/MorphTo.php @@ -106,11 +106,9 @@ public function toArray(): array */ public function toInput(Request $request, Model $model): array { - $relation = $this->getRelation($model); - return array_merge(parent::toInput($request, $model), [ 'url' => $this->replaceRoutePlaceholders($request->route()), - 'morphTypeName' => $name = $relation->getMorphType(), + 'morphTypeName' => $name = $this->getRelation($model)->getMorphType(), 'morphType' => $model->getAttribute($name), ]); }