Skip to content
New issue

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

Update RevisionableTrait.php #386

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 12 additions & 9 deletions src/Venturecraft/Revisionable/RevisionableTrait.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
<?php namespace Venturecraft\Revisionable;

use Illuminate\Support\Arr;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Event;
use Venturecraft\Revisionable\Revisionable;

/*
* This file is part of the Revisionable package by Venture Craft
Expand Down Expand Up @@ -210,8 +213,8 @@ public function postSave()
}
}
$revision = Revisionable::newModel();
\DB::table($revision->getTable())->insert($revisions);
\Event::dispatch('revisionable.saved', array('model' => $this, 'revisions' => $revisions));
DB::table($revision->getTable())->insert($revisions);
Event::dispatch('revisionable.saved', array('model' => $this, 'revisions' => $revisions));
}
}
}
Expand Down Expand Up @@ -248,8 +251,8 @@ public function postCreate()
$revisions = array_merge($revisions[0], $this->getAdditionalFields());

$revision = Revisionable::newModel();
\DB::table($revision->getTable())->insert($revisions);
\Event::dispatch('revisionable.created', array('model' => $this, 'revisions' => $revisions));
DB::table($revision->getTable())->insert($revisions);
Event::dispatch('revisionable.created', array('model' => $this, 'revisions' => $revisions));
}

}
Expand Down Expand Up @@ -278,8 +281,8 @@ public function postDelete()
$revisions = array_merge($revisions[0], $this->getAdditionalFields());

$revision = Revisionable::newModel();
\DB::table($revision->getTable())->insert($revisions);
\Event::dispatch('revisionable.deleted', array('model' => $this, 'revisions' => $revisions));
DB::table($revision->getTable())->insert($revisions);
Event::dispatch('revisionable.deleted', array('model' => $this, 'revisions' => $revisions));
}
}

Expand Down Expand Up @@ -309,8 +312,8 @@ public function postForceDelete()
);

$revision = Revisionable::newModel();
\DB::table($revision->getTable())->insert($revisions);
\Event::dispatch('revisionable.deleted', array('model' => $this, 'revisions' => $revisions));
DB::table($revision->getTable())->insert($revisions);
Event::dispatch('revisionable.deleted', array('model' => $this, 'revisions' => $revisions));
}
}

Expand Down Expand Up @@ -518,7 +521,7 @@ public function disableRevisionField($field)
*
* @return mixed
*/
private function sortJsonKeys($attribute)
private function sortJsonKeys($attribute)DB
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Assume this is a mistake?

{
if(empty($attribute)) return $attribute;

Expand Down