An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 360+ one-click services on your own servers.
PHP coolifydatabasesdeploymentdockerdocker-composeinertiajslaravelmariadbmysqlnextjsnodejsphppostgresredisself-hostedself-hostingserverstatic-sitesveltesvelte5
fix: exclude system and computed fields from model replication
peaklabs-devd53065967ec5
diff --git a/app/Livewire/Project/CloneMe.php b/app/Livewire/Project/CloneMe.phpindex 593355c443..02cee30e1d 100644--- a/app/Livewire/Project/CloneMe.php+++ b/app/Livewire/Project/CloneMe.php@@ -109,7 +109,13 @@ class CloneMe extends Component$services = $this->environment->services;foreach ($applications as $application) {$uuid = (string) new Cuid2;- $newApplication = $application->replicate()->fill([+ $newApplication = $application->replicate([+ 'id',+ 'created_at',+ 'updated_at',+ 'additional_servers_count',+ 'additional_networks_count',+ ])->fill(['uuid' => $uuid,'fqdn' => generateFqdn($this->server, $uuid),'status' => 'exited',@@ -120,14 +126,26 @@ class CloneMe extends Component$newApplication->save();$environmentVaribles = $application->environment_variables()->get();foreach ($environmentVaribles as $environmentVarible) {- $newEnvironmentVariable = $environmentVarible->replicate()->fill([+ $newEnvironmentVariable = $environmentVarible->replicate([+ 'id',+ 'created_at',+ 'updated_at',+ 'additional_servers_count',+ 'additional_networks_count',+ ])->fill(['resourceable_id' => $newApplication->id,]);$newEnvironmentVariable->save();}$persistentVolumes = $application->persistentStorages()->get();foreach ($persistentVolumes as $volume) {- $newPersistentVolume = $volume->replicate()->fill([+ $newPersistentVolume = $volume->replicate([+ 'id',+ 'created_at',+ 'updated_at',+ 'additional_servers_count',+ 'additional_networks_count',+ ])->fill(['name' => $newApplication->uuid.'-'.str($volume->name)->afterLast('-'),'resource_id' => $newApplication->id,]);@@ -136,7 +154,13 @@ class CloneMe extends Component}foreach ($databases as $database) {$uuid = (string) new Cuid2;- $newDatabase = $database->replicate()->fill([+ $newDatabase = $database->replicate([+ 'id',+ 'created_at',+ 'updated_at',+ 'additional_servers_count',+ 'additional_networks_count',+ ])->fill(['uuid' => $uuid,'status' => 'exited','started_at' => null,@@ -149,13 +173,25 @@ class CloneMe extends Component$payload = [];$payload['resourceable_id'] = $newDatabase->id;$payload['resourceable_type'] = $newDatabase->getMorphClass();- $newEnvironmentVariable = $environmentVarible->replicate()->fill($payload);+ $newEnvironmentVariable = $environmentVarible->replicate([+ 'id',+ 'created_at',+ 'updated_at',+ 'additional_servers_count',+ 'additional_networks_count',+ ])->fill($payload);$newEnvironmentVariable->save();}}foreach ($services as $service) {$uuid = (string) new Cuid2;- $newService = $service->replicate()->fill([+ $newService = $service->replicate([+ 'id',+ 'created_at',+ 'updated_at',+ 'additional_servers_count',+ 'additional_networks_count',+ ])->fill(['uuid' => $uuid,'environment_id' => $environment->id,'destination_id' => $this->selectedDestination,diff --git a/app/Livewire/Project/Shared/ResourceOperations.php b/app/Livewire/Project/Shared/ResourceOperations.phpindex c6a32f0c7a..0c79bf0aa6 100644--- a/app/Livewire/Project/Shared/ResourceOperations.php+++ b/app/Livewire/Project/Shared/ResourceOperations.php@@ -44,7 +44,13 @@ class ResourceOperations extends Componentif ($this->resource->getMorphClass() === \App\Models\Application::class) {$name = 'clone-of-'.str($this->resource->name)->limit(20).'-'.$uuid;- $new_resource = $this->resource->replicate()->fill([+ $new_resource = $this->resource->replicate([+ 'id',+ 'created_at',+ 'updated_at',+ 'additional_servers_count',+ 'additional_networks_count',+ ])->fill(['uuid' => $uuid,'name' => $name,'fqdn' => generateFqdn($server, $uuid),@@ -59,7 +65,13 @@ class ResourceOperations extends Component}$environmentVaribles = $this->resource->environment_variables()->get();foreach ($environmentVaribles as $environmentVarible) {- $newEnvironmentVariable = $environmentVarible->replicate()->fill([+ $newEnvironmentVariable = $environmentVarible->replicate([+ 'id',+ 'created_at',+ 'updated_at',+ 'additional_servers_count',+ 'additional_networks_count',+ ])->fill(['resourceable_id' => $new_resource->id,'resourceable_type' => $new_resource->getMorphClass(),]);@@ -71,7 +83,13 @@ class ResourceOperations extends Componentif ($volumeName === $volume->name) {$volumeName = $new_resource->uuid.'-'.str($volume->name)->afterLast('-');}- $newPersistentVolume = $volume->replicate()->fill([+ $newPersistentVolume = $volume->replicate([+ 'id',+ 'created_at',+ 'updated_at',+ 'additional_servers_count',+ 'additional_networks_count',+ ])->fill(['name' => $volumeName,'resource_id' => $new_resource->id,]);@@ -95,7 +113,13 @@ class ResourceOperations extends Component$this->resource->getMorphClass() === \App\Models\StandaloneClickhouse::class) {$uuid = (string) new Cuid2;- $new_resource = $this->resource->replicate()->fill([+ $new_resource = $this->resource->replicate([+ 'id',+ 'created_at',+ 'updated_at',+ 'additional_servers_count',+ 'additional_networks_count',+ ])->fill(['uuid' => $uuid,'name' => $this->resource->name.'-clone-'.$uuid,'status' => 'exited',@@ -117,7 +141,13 @@ class ResourceOperations extends Component} elseif ($this->resource->type() === 'standalone-mariadb') {$payload['standalone_mariadb_id'] = $new_resource->id;}- $newEnvironmentVariable = $environmentVarible->replicate()->fill($payload);+ $newEnvironmentVariable = $environmentVarible->replicate([+ 'id',+ 'created_at',+ 'updated_at',+ 'additional_servers_count',+ 'additional_networks_count',+ ])->fill($payload);$newEnvironmentVariable->save();}$route = route('project.database.configuration', [@@ -129,7 +159,13 @@ class ResourceOperations extends Componentreturn redirect()->to($route);} elseif ($this->resource->type() === 'service') {$uuid = (string) new Cuid2;- $new_resource = $this->resource->replicate()->fill([+ $new_resource = $this->resource->replicate([+ 'id',+ 'created_at',+ 'updated_at',+ 'additional_servers_count',+ 'additional_networks_count',+ ])->fill(['uuid' => $uuid,'name' => $this->resource->name.'-clone-'.$uuid,'destination_id' => $new_destination->id,