From eaff0ad17eae70330bee8795016532a3046d55bd Mon Sep 17 00:00:00 2001 From: abdulmajid Date: Fri, 27 May 2022 17:23:56 +0100 Subject: [PATCH] Fixed Synced resources between tenants throws error when inserting new model on tenant --- src/Listeners/UpdateSyncedResource.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Listeners/UpdateSyncedResource.php b/src/Listeners/UpdateSyncedResource.php index 40d4d644..e11002e0 100644 --- a/src/Listeners/UpdateSyncedResource.php +++ b/src/Listeners/UpdateSyncedResource.php @@ -60,7 +60,7 @@ 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()); + $centralModel = $event->model->getCentralModelName()::create(collect($event->model->getAttributes())->except(['id'])->toArray()); event(new SyncedResourceChangedInForeignDatabase($event->model, null)); } });