1
0
Fork 0
mirror of https://github.com/archtechx/tenancy.git synced 2026-02-05 15:54:03 +00:00

Fix: Sync when ID's are duplicated

This commit is contained in:
Ion Caliman 2023-06-21 18:59:35 +03:00
parent 4bc82b535a
commit a56c70779f

View file

@ -60,7 +60,10 @@ class UpdateSyncedResource extends QueueableListener
} else { } else {
// If the resource doesn't exist at all in the central DB,we create // If the resource doesn't exist at all in the central DB,we create
// the record with all attributes, not just the synced ones. // the record with all attributes, not just the synced ones.
$centralModel = $event->model->getCentralModelName()::create($event->model->getAttributes()); $attributes = $event->model->getAttributes();
unset($attributes['id']);
$centralModel = $event->model->getCentralModelName()::create($attributes);
event(new SyncedResourceChangedInForeignDatabase($event->model, null)); event(new SyncedResourceChangedInForeignDatabase($event->model, null));
} }
}); });