From 7d51faeb590288bd186200aae4239be1447188cd Mon Sep 17 00:00:00 2001 From: Marco P Date: Thu, 16 May 2024 00:07:13 +0200 Subject: [PATCH] Versionable::createInitialVersion fails if any global scope excludes Model (#74) --- src/Versionable.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Versionable.php b/src/Versionable.php index 98fa4aa..58b0cfa 100644 --- a/src/Versionable.php +++ b/src/Versionable.php @@ -80,7 +80,7 @@ public function createVersion(array $replacements = [], $time = null): ?Version public function createInitialVersion(Model $model): Version { /** @var \Overtrue\LaravelVersionable\Versionable|Model $refreshedModel */ - $refreshedModel = static::query()->findOrFail($model->getKey()); + $refreshedModel = static::query()->withoutGlobalScopes()->findOrFail($model->getKey()); /** * As initial version should include all $versionable fields,