diff --git a/src/Migrator/Pipes/CreateNewMetadata.php b/src/Migrator/Pipes/CreateNewMetadata.php index 107eb2b..f6e9a89 100644 --- a/src/Migrator/Pipes/CreateNewMetadata.php +++ b/src/Migrator/Pipes/CreateNewMetadata.php @@ -150,7 +150,7 @@ protected function fillSettings(Metadata $metadata, Collection $models): int ->select([ DB::raw("'{$metadata->getKey()}' as metadata_id"), DB::raw("{$model->getKeyName()} as settable_id"), - DB::raw("'". str_replace("\\\\", "\\", addcslashes($model->getMorphClass(), '\\'))."' as settable_type"), + DB::raw("'" . addcslashes($model->getMorphClass(), '\\') . "' as settable_type"), DB::raw("'{$metadata->getRawOriginal('default', 'NULL')}' as value"), DB::raw("'{$this->now->toDateTimeString()}' as created_at"), DB::raw("'{$this->now->toDateTimeString()}' as updated_at"), diff --git a/tests/Console/Commands/MigrateCommandTest.php b/tests/Console/Commands/MigrateCommandTest.php index c1c9a43..03d41cc 100644 --- a/tests/Console/Commands/MigrateCommandTest.php +++ b/tests/Console/Commands/MigrateCommandTest.php @@ -368,7 +368,7 @@ public function test_creates_new_setting(): void $this->assertDatabaseHas('user_settings', [ 'id' => 1, 'metadata_id' => 1, - 'settable_type' => DummyModel::class, + 'settable_type' => addcslashes(DummyModel::class, '\\'), // orchestras database substitute is weird 'settable_id' => 1, 'value' => '', 'is_enabled' => true,