mirror of
https://github.com/archtechx/tenancy.git
synced 2026-03-22 17:54:03 +00:00
Fix central model creation to use only synced attributes
This commit is contained in:
parent
04f82fb813
commit
90272bcbb1
1 changed files with 3 additions and 1 deletions
|
|
@ -60,7 +60,9 @@ 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());
|
|
||||||
|
// 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));
|
event(new SyncedResourceChangedInForeignDatabase($event->model, null));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue