diff --git a/src/Listeners/UpdateSyncedResource.php b/src/Listeners/UpdateSyncedResource.php index ba5cb489..39391eac 100644 --- a/src/Listeners/UpdateSyncedResource.php +++ b/src/Listeners/UpdateSyncedResource.php @@ -150,10 +150,11 @@ class UpdateSyncedResource extends QueueableListener if (Arr::isAssoc($model->getSyncedCreationAttributes())) { // Developer provided the default values (key => value) or mix of default values and attribute names (values only) - // We will merge the default values with sync attributes - [$attributes, $defaultValues] = $this->getAttributeNamesAndDefaultValues($model); + // We will merge the default values with provided attributes and sync attributes + [$attributeNames, $defaultValues] = $this->getAttributeNamesAndDefaultValues($model); + $attributes = $model->only(array_merge($model->getSyncedAttributeNames(), $attributeNames)); - return array_merge($model->only(array_merge($model->getSyncedAttributeNames(), $attributes)), $defaultValues); + return array_merge($attributes, $defaultValues); } // Developer provided the attribute names, so we'll use them to pick model attributes diff --git a/tests/ResourceSyncingTest.php b/tests/ResourceSyncingTest.php index 5a9347ee..4d7c82ee 100644 --- a/tests/ResourceSyncingTest.php +++ b/tests/ResourceSyncingTest.php @@ -784,10 +784,10 @@ function createTenantsAndRunMigrations(): array /** * Run tenant migrations using the tenants:migrate command. */ -function migrateTenantsResource(?string $path = null): void +function migrateTenantsResource(): void { pest()->artisan('tenants:migrate', [ - '--path' => $path ?? __DIR__ . '/Etc/synced_resource_migrations/users', + '--path' => __DIR__ . '/Etc/synced_resource_migrations/users', '--realpath' => true, ])->assertExitCode(0); }