diff --git a/src/Mpociot/Versionable/Version.php b/src/Mpociot/Versionable/Version.php index a9191d8..ecb13f5 100644 --- a/src/Mpociot/Versionable/Version.php +++ b/src/Mpociot/Versionable/Version.php @@ -47,9 +47,13 @@ public function getResponsibleUserAttribute() */ public function getModel() { + $modelData = is_resource($this->model_data) + ? stream_get_contents($this->model_data) + : $this->model_data; + $model = new $this->versionable_type(); $model->unguard(); - $model->fill(unserialize($this->model_data)); + $model->fill(unserialize($modelData)); $model->exists = true; $model->reguard(); return $model;