loadMissing('projectTemplate'); if ($project->projectTemplate === null || $project->projectTemplate->is_published) { return; } $snapshot = $this->duplicateProjectConfiguration->normalizeConfiguration( $project->projectTemplate->configuration_snapshot ?? [], ); $project->projectTemplate->forceFill([ 'configuration_snapshot' => array_replace( $snapshot, $this->duplicateProjectConfiguration->export($project->fresh(), [$area]), ), ])->saveQuietly(); } }