update() public method

Update a record in the database.
public update ( array $values ) : integer
$values array
return integer
 /**
  * Restore the soft-deleted model instances.
  *
  * @return int
  */
 public function restore()
 {
     if ($this->model->isSoftDeleting()) {
         $column = $this->model->getDeletedAtColumn();
         return $this->query->update(array($column => null));
     }
 }
 /**
  * update data
  *
  * @param array $args update data
  * @return int
  */
 public function update(array $args)
 {
     if ($this->dynamic === false) {
         return $this->query->update($args);
     }
     $result = 0;
     if (count($update = $this->filter($args, $this->schema())) > 0) {
         $result = $this->query->update($update);
     }
     if ($this->proxy === true) {
         $wheres = $this->query->wheres === null ? [] : $this->query->wheres;
         $this->getProxyManager()->update($args, $wheres);
     }
     return $result;
 }
Example #3
0
 /**
  * Update a record in the database.
  *
  * @param  array  $values
  * @return int
  */
 public function update(array $values)
 {
     return $this->query->update($this->addUpdatedAtColumn($values));
 }
Example #4
0
 /**
  * Update a record in the database.
  *
  * @param  array $values
  *
  * @return int
  */
 public function update(array $values)
 {
     $result = parent::update($values);
     $this->handler->setBuilder($this)->setValues($values)->setSqlOperation('update')->invalidateQuery('update');
     return $result;
 }
Example #5
0
 public function update(array $values)
 {
     if ($this->needFlushCache()) {
         // 清空表级缓存
         $meta = $this->getMeta();
         $meta->flush($this->db(), $this->model->table());
         $this->flushAffectingRowCache();
     }
     return parent::update($values);
 }
Example #6
0
 /**
  * Update a record in the database.
  *
  * @param  array $values
  *
  * @return int
  */
 public function update(array $values)
 {
     $result = parent::update($values);
     $this->handler->setBuilder($this)->invalidateQuery(Reflector::QUERY_TYPE_UPDATE, $values);
     return $result;
 }