Skip to content

Commit

Permalink
Merge pull request #13 from williamoliveira/patch-1
Browse files Browse the repository at this point in the history
Fix unserialize() for Postgres
  • Loading branch information
mpociot committed May 6, 2016
2 parents 9d81f03 + ea250ce commit a801730
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/Mpociot/Versionable/Version.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit a801730

Please sign in to comment.