当前位置: 首页>>代码示例>>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;未经允许,请勿转载。