當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。