Illuminate\Database\Eloquent\Model::update PHP Method

update() public method

Update the model in the database.
public update ( array $attributes = [], array $options = [] ) : boolean
$attributes array
$options array
return boolean
    public function update(array $attributes = [], array $options = [])
    {
        if (!$this->exists) {
            return false;
        }
        return $this->fill($attributes)->save($options);
    }

Usage Example

Example #1
0
 /**
  * Update a user.
  *
  * @param Model $item
  * @param array $data
  * @return bool|int
  */
 public function update(Model $item, array $data)
 {
     if (isset($data['password'])) {
         $data['password'] = bcrypt($data['password']);
     }
     return $item->update($data);
 }
All Usage Examples Of Illuminate\Database\Eloquent\Model::update
Model