当前位置: 首页>>代码示例>>PHP>>正文


PHP Revision::getTable方法代码示例

本文整理汇总了PHP中Revision::getTable方法的典型用法代码示例。如果您正苦于以下问题:PHP Revision::getTable方法的具体用法?PHP Revision::getTable怎么用?PHP Revision::getTable使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Revision的用法示例。


在下文中一共展示了Revision::getTable方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: postCreate

 /**
  * Called after record successfully created
  */
 public function postCreate()
 {
     // Check if we should store creations in our revision history
     // Set this value to true in your model if you want to
     if (empty($this->revisionCreationsEnabled)) {
         // We should not store creations.
         return false;
     }
     if (!isset($this->revisionEnabled) || $this->revisionEnabled) {
         $revisions[] = array('revisionable_type' => get_class($this), 'revisionable_id' => $this->getKey(), 'key' => 'created_at', 'old_value' => null, 'new_value' => $this->created_at, 'user_id' => $this->getUserId(), 'created_at' => new \DateTime(), 'updated_at' => new \DateTime());
         $revision = new Revision();
         \DB::table($revision->getTable())->insert($revisions);
     }
 }
开发者ID:chrishurlburt,项目名称:revisionable,代码行数:17,代码来源:RevisionableTrait.php

示例2: postCreate

 /**
  * Called after record successfully created
  */
 public function postCreate()
 {
     // Check if we should store creations in our revision history
     // Set this value to true in your model if you want to
     if (empty($this->revisionCreationsEnabled)) {
         // We should not store creations.
         return false;
     }
     if (!isset($this->revisionEnabled) || $this->revisionEnabled) {
         $changes_to_record = $this->changedRevisionableFields();
         $newValue = array();
         foreach ($changes_to_record as $key => $change) {
             $newValue[$key] = $this->updatedData[$key];
         }
         $revisions[] = array('revisionable_type' => get_class($this), 'revisionable_id' => $this->getKey(), 'key' => 'created_at', 'old_value' => null, 'new_value' => json_encode($newValue), 'user_id' => $this->getUserId(), 'created_at' => new \DateTime(), 'updated_at' => new \DateTime(), 'ip' => \Request::ip());
         $revision = new Revision();
         \DB::table($revision->getTable())->insert($revisions);
     }
 }
开发者ID:sensorial-dev,项目名称:revisionable,代码行数:22,代码来源:RevisionableTrait.php

示例3: postCreate

 /**
  * Called after record successfully created
  */
 public function postCreate()
 {
     // Check if we should store creations in our revision history
     // Set this value to true in your model if you want to
     if (empty($this->revisionCreationsEnabled)) {
         // We should not store creations.
         return false;
     }
     if (!isset($this->revisionEnabled) || $this->revisionEnabled) {
         $revisions[] = array('revisionable_type' => $this->getMorphClass(), 'revisionable_id' => $this->getKey(), 'key' => self::CREATED_AT, 'old_value' => null, 'new_value' => $this->{self::CREATED_AT}, 'user_id' => $this->getSystemUserId(), 'created_at' => new \DateTime(), 'updated_at' => new \DateTime());
         $revision = new Revision();
         \DB::table($revision->getTable())->insert($revisions);
         \Event::fire('revisionable.created', array('model' => $this, 'revisions' => $revisions));
     }
 }
开发者ID:venturecraft,项目名称:revisionable,代码行数:18,代码来源:RevisionableTrait.php

示例4: postSave

 /**
  * Called after a model is successfully saved.
  *
  * @return void
  */
 public function postSave()
 {
     if (isset($this->historyLimit) && $this->revisionHistory()->count() >= $this->historyLimit) {
         $LimitReached = true;
     } else {
         $LimitReached = false;
     }
     // check if the model already exists
     if ((!isset($this->revisionEnabled) || $this->revisionEnabled) && $this->updating && !$LimitReached) {
         // if it does, it means we're updating
         $changes_to_record = $this->changedRevisionableFields();
         $revisions = array();
         foreach ($changes_to_record as $key => $change) {
             $revisions[] = array('revisionable_type' => get_class($this), 'revisionable_id' => $this->getKey(), 'key' => $key, 'old_value' => array_get($this->originalData, $key), 'new_value' => $this->updatedData[$key], 'user_id' => $this->getUserId(), 'created_at' => new \DateTime(), 'updated_at' => new \DateTime());
         }
         if (count($revisions) > 0) {
             $revision = new Revision();
             \DB::table($revision->getTable())->insert($revisions);
         }
     }
 }
开发者ID:rajivseelam,项目名称:revisionable,代码行数:26,代码来源:RevisionableTrait.php

示例5: postDelete

 /**
  * 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();
         $revisions[] = array('revisionable_type' => $this->getTable(), 'revisionable_id' => $this->getKey(), 'key' => 'deleted_at', 'old_value' => null, 'new_value' => $this->deleted_at, 'user_id' => $this->getUserId(), 'created_at' => new \DateTime());
         $revision = new Revision();
         \DB::table($revision->getTable())->insert($revisions);
     }
 }
开发者ID:georgeneculai,项目名称:laravel-toolkit,代码行数:12,代码来源:RevisionableTrait.php


注:本文中的Revision::getTable方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。