Update ReplicateAction.php

This commit is contained in:
Dan Harrin
2025-08-01 08:11:59 -06:00
parent 4874b95240
commit 01646e4447
+9
View File
@@ -144,4 +144,13 @@ class ReplicateAction extends Action
default => parent::resolveDefaultClosureDependencyForEvaluationByName($parameterName),
};
}
public function getSchema(Schema $schema): ?Schema
{
// By default, the schema's model will be set to the original record that is being replicated.
// However, since the schema is used to create a new replica, it is more appropriate to set
// the schema's model to the replica model FQN instead. This ensures that it does not
// behave as if the original record is edited instead of a new record being created.
return parent::getSchema($schema)?->model($this->getModel());
}
}