src/BaseRepositoryEloquent.php
public function update($id, array $attributes)
    {
        $model = $this->model->findOrFail($id);

        $this->validation()->validate('update', array_merge($attributes, [$this->model->getKeyName() => $id]));

        $model->fill($attributes);

        $model->save();

        return $model;
    }
public function update($id, array $attributes)
    {
        $model = $this->model->findOrFail($id);

        $this->validation()->validate('update', array_merge($attributes, [$this->model->getKeyName() => $id]));

        $model->fill($attributes);

        $model->save();

        return $model;
    }
public function update ( $ id , array $ attributes ) { $ model = $ this -> model -> findOrFail ( $ id ) ; $ this -> validation ( ) -> validate ( 'update' , array_merge ( $ attributes , [ $ this -> model -> getKeyName ( ) => $ id ] ) ) ; $ model -> fill ( $ attributes ) ; $ model -> save ( ) ; return $ model ; }
Update the model or models attributes.
@param  int|null  $id
@param  array  $attributes
@throws \Exception  When id is not given
@throws \Illuminate\Database\Eloquent\ModelNotFoundException
@return \Illuminate\Database\Eloquent\Model
Update the model or models attributes .