From 90272bcbb196c539a9a7993151d04dce3f6d8b98 Mon Sep 17 00:00:00 2001 From: "Leandro G. Gehlen" Date: Thu, 10 Jul 2025 07:15:32 -0300 Subject: [PATCH] Fix central model creation to use only synced attributes --- src/Listeners/UpdateSyncedResource.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Listeners/UpdateSyncedResource.php b/src/Listeners/UpdateSyncedResource.php index 40d4d644..9c338e99 100644 --- a/src/Listeners/UpdateSyncedResource.php +++ b/src/Listeners/UpdateSyncedResource.php @@ -60,7 +60,9 @@ class UpdateSyncedResource extends QueueableListener } else { // If the resource doesn't exist at all in the central DB,we create // the record with all attributes, not just the synced ones. - $centralModel = $event->model->getCentralModelName()::create($event->model->getAttributes()); + + // It's necessary to use $syncedAttributes when tenant model contains extra attributes to central model + $centralModel = $event->model->getCentralModelName()::create($syncedAttributes); event(new SyncedResourceChangedInForeignDatabase($event->model, null)); } });