mirror of
https://github.com/filamentphp/filament.git
synced 2026-09-24 15:42:09 +08:00
Update ReplicateAction.php
This commit is contained in:
@@ -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());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user