當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Builder::update方法代碼示例

本文整理匯總了PHP中Illuminate\Database\Eloquent\Builder::update方法的典型用法代碼示例。如果您正苦於以下問題:PHP Builder::update方法的具體用法?PHP Builder::update怎麽用?PHP Builder::update使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Illuminate\Database\Eloquent\Builder的用法示例。


在下文中一共展示了Builder::update方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: addRestore

 /**
  * Add the restore extension to the builder.
  *
  * @param  \Illuminate\Database\Eloquent\Builder  $builder
  * @return void
  */
 protected function addRestore(Builder $builder)
 {
     $builder->macro('restore', function (Builder $builder) {
         $builder->withTrashed();
         return $builder->update([$builder->getModel()->getDeletedAtColumn() => 'publish']);
     });
 }
開發者ID:creativelittledots,項目名稱:wp-kit-core,代碼行數:13,代碼來源:SoftDeletingScope.php

示例2: update

 public function update(array $values)
 {
     foreach ($values as $key => &$value) {
         if ($value instanceof GeometryInterface) {
             $value = $this->asWKT($value);
         }
     }
     return parent::update($values);
 }
開發者ID:jubairsaidi,項目名稱:laravel-postgis,代碼行數:9,代碼來源:Builder.php

示例3: update

 /**
  * Update a record in the database.
  *
  * @param  array  $values
  * @return int
  */
 public function update(array $values)
 {
     // Intercept operations on embedded models and delegate logic
     // to the parent relation instance.
     if ($relation = $this->model->getParentRelation()) {
         $relation->performUpdate($this->model, $values);
         return 1;
     }
     return parent::update($values);
 }
開發者ID:errietta,項目名稱:laravel-mongodb,代碼行數:16,代碼來源:Builder.php

示例4: update

 /**
  * @param array $entity
  *
  * @return bool
  */
 public function update($entity)
 {
     $data = $this->mapper->toDbTableRow($entity);
     $this->specificationQuery->update($data->toArray());
     return true;
 }
開發者ID:middleout,項目名稱:doplio,代碼行數:11,代碼來源:AbstractRepository.php

示例5: rawUpdate

 /**
  * Run a raw update against the base query.
  *
  * @param  array  $attributes
  * @return int
  */
 public function rawUpdate(array $attributes = [])
 {
     return $this->query->update($attributes);
 }
開發者ID:ProgrammingPeter,項目名稱:nba-schedule-api,代碼行數:10,代碼來源:Relation.php

示例6: addReject

 /**
  * Add the Reject extension to the builder.
  *
  * @param  \Illuminate\Database\Eloquent\Builder $builder
  *
  * @return void
  */
 protected function addReject(Builder $builder)
 {
     $builder->macro('reject', function (Builder $builder, $id = null) {
         $builder->withAnyStatus();
         //If $id parameter is passed then update the specified model
         if ($id) {
             $model = $builder->find($id);
             $model->{$model->getStatusColumn()} = Status::REJECTED;
             $model->{$model->getModeratedAtColumn()} = Carbon::now();
             return $model->save();
         }
         return $builder->update([$builder->getModel()->getStatusColumn() => Status::REJECTED, $builder->getModel()->getModeratedAtColumn() => Carbon::now()]);
     });
 }
開發者ID:gecche,項目名稱:laravel-moderation,代碼行數:21,代碼來源:ModerationScope.php

示例7: update

 /**
  * Update a record in the database.
  *
  * @param array $values
  * @return int
  */
 public function update(array $values)
 {
     $this->model->fireEvent('updatingMultiple');
     $return = parent::update($values);
     $this->model->fireEvent('updatedMultiple');
     return $return;
 }
開發者ID:jacksun101,項目名稱:streams-platform,代碼行數:13,代碼來源:EloquentQueryBuilder.php

示例8: addDoFeature

 /**
  * Add the restore extension to the builder.
  *
  * @param  \Illuminate\Database\Eloquent\Builder  $builder
  * @return void
  */
 protected function addDoFeature(Builder $builder)
 {
     $builder->macro('dofeature', function (Builder $builder) {
         return $builder->update([$builder->getModel()->getFeaturedAtColumn() => $builder->getModel()->freshTimestampString()]);
     });
 }
開發者ID:dr3ads,項目名稱:FeaturedTrait,代碼行數:12,代碼來源:FeaturedScope.php

示例9: update

 public function update(array $values)
 {
     if ($this->eagerLoad) {
         $this->prepareQuery();
         $this->buildRelationshipTree();
         $this->applyRelationshipQuery($this->relations);
         $this->reformatQueryComponents();
     }
     parent::update($values);
 }
開發者ID:fembri,項目名稱:eloficient,代碼行數:10,代碼來源:Builder.php

示例10: updateModerationStatus

 /**
  * @param \Illuminate\Database\Eloquent\Builder $builder
  * @param $id
  * @param $status
  *
  * @return bool|int
  */
 private function updateModerationStatus(Builder $builder, $id, $status)
 {
     //If $id parameter is passed then update the specified model
     if ($id) {
         $model = $builder->find($id);
         $model->{$model->getStatusColumn()} = $status;
         $model->{$model->getModeratedAtColumn()} = Carbon::now();
         //if moderated_by in enabled then append it to the update
         if ($moderated_by = $model->getModeratedByColumn()) {
             $model->{$moderated_by} = \Auth::user()->getKey();
         }
         $model->save();
         return $model;
     }
     $update = [$builder->getModel()->getStatusColumn() => $status, $builder->getModel()->getModeratedAtColumn() => Carbon::now()];
     //if moderated_by in enabled then append it to the update
     if ($moderated_by = $builder->getModel()->getModeratedByColumn()) {
         $update[$builder->getModel()->getModeratedByColumn()] = \Auth::user()->getKey();
     }
     return $builder->update($update);
 }
開發者ID:hootlex,項目名稱:laravel-moderation,代碼行數:28,代碼來源:ModerationScope.php


注:本文中的Illuminate\Database\Eloquent\Builder::update方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。