We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Revert not work $post->getVersion(3)->revert(); $post->revertToVersion(3);
without comment out when VersionStrategy::DIFF
// if (! empty($this->contents)) { // $this->versionable->setRawAttributes(array_merge($original, $this->contents)); // }
public function revertWithoutSaving(): ?Model { $original = $this->versionable->getRawOriginal(); switch ($this->versionable->getVersionStrategy()) { case VersionStrategy::DIFF: // v1 + ... + vN $versionsBeforeThis = $this->previousVersions()->orderOldestFirst()->get(); foreach ($versionsBeforeThis as $version) { if (! empty($version->contents)) { $this->versionable->setRawAttributes(array_merge($original, $version->contents)); } } break; case VersionStrategy::SNAPSHOT: // v1 + vN /** @var \Overtrue\LaravelVersionable\Version $initVersion */ $initVersion = $this->versionable->versions()->first(); if (! empty($initVersion->contents)) { $this->versionable->setRawAttributes(array_merge($original, $initVersion->contents)); } } // if (! empty($this->contents)) { // $this->versionable->setRawAttributes(array_merge($original, $this->contents)); // } return $this->versionable; }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Revert not work
$post->getVersion(3)->revert();
$post->revertToVersion(3);
without comment out when VersionStrategy::DIFF
// if (! empty($this->contents)) {
// $this->versionable->setRawAttributes(array_merge($original, $this->contents));
// }
The text was updated successfully, but these errors were encountered: