/**
  * If softdeletes are enabled, store the deleted time
  */
 public function postDelete()
 {
     if ((!isset($this->revisionEnabled) || $this->revisionEnabled) && $this->isSoftDelete() && $this->isRevisionable('deleted_at')) {
         $revisions[] = array('revisionable_type' => get_class($this), 'revisionable_id' => $this->getKey(), 'key' => 'deleted_at', 'old_value' => null, 'new_value' => $this->deleted_at, 'user_id' => $this->getUserId(), 'created_at' => new \DateTime(), 'updated_at' => new \DateTime());
         $revision = new \Venturecraft\Revisionable\Revision();
         \DB::table($revision->getTable())->insert($revisions);
     }
 }
 /**
  * If softdeletes are enabled, store the deleted time
  */
 public function postDelete()
 {
     if (!isset($this->revisionEnabled) || $this->revisionEnabled) {
         $oldValue = array();
         foreach ($this->updatedData as $key => $value) {
             if ($this->isRevisionable($key) && !is_array($value)) {
                 $oldValue[$key] = $this->updatedData[$key];
             }
         }
         $revisions[] = array('revisionable_type' => get_class($this), 'revisionable_id' => $this->getKey(), 'key' => 'deleted_at', 'old_value' => json_encode($oldValue), 'new_value' => null, 'user_id' => $this->getUserId(), 'created_at' => new \DateTime(), 'updated_at' => new \DateTime(), 'ip' => \Request::ip());
         $revision = new \Venturecraft\Revisionable\Revision();
         \DB::table($revision->getTable())->insert($revisions);
     }
 }
Ejemplo n.º 3
0
 private function saveRevision($revisions)
 {
     $revision = new \Venturecraft\Revisionable\Revision();
     return \DB::table($revision->getTable())->insert($revisions);
 }
 /**
  * If softdeletes are enabled, store the deleted time
  */
 public function postDelete()
 {
     if ((!isset($this->revisionEnabled) || $this->revisionEnabled) && $this->isSoftDelete() && $this->isRevisionable($this->getDeletedAtColumn())) {
         $revisions[] = array('revisionable_type' => $this->getMorphClass(), 'revisionable_id' => $this->getKey(), 'key' => $this->getDeletedAtColumn(), 'old_value' => null, 'new_value' => $this->{$this->getDeletedAtColumn()}, 'user_id' => $this->getSystemUserId(), 'created_at' => new \DateTime(), 'updated_at' => new \DateTime());
         $revision = new \Venturecraft\Revisionable\Revision();
         \DB::table($revision->getTable())->insert($revisions);
         \Event::fire('revisionable.deleted', array('model' => $this, 'revisions' => $revisions));
     }
 }