src/BaseRepositoryEloquent.php
public function updateMany(array $items)
    {
        $ids    = array_pluck($items, $this->model->getKeyName());
        $models = $this->model->find($ids);

        foreach ($models as $model) {
            $attributes = array_first($items, function ($i, $attributes) use ($model) {
                if (!array_key_exists($model->getKeyName(), $attributes)) {
                    return false;
                }

                return $attributes[$model->getKeyName()] == $model->getKey();
            });

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

            $model->fill($attributes);
            $model->save();
        }

        return $models;
    }
public function updateMany(array $items)
    {
        $ids    = array_pluck($items, $this->model->getKeyName());
        $models = $this->model->find($ids);

        foreach ($models as $model) {
            $attributes = array_first($items, function ($i, $attributes) use ($model) {
                if (!array_key_exists($model->getKeyName(), $attributes)) {
                    return false;
                }

                return $attributes[$model->getKeyName()] == $model->getKey();
            });

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

            $model->fill($attributes);
            $model->save();
        }

        return $models;
    }
public function updateMany ( array $ items ) { $ ids = array_pluck ( $ items , $ this -> model -> getKeyName ( ) ) ; $ models = $ this -> model -> find ( $ ids ) ; foreach ( $ models as $ model ) { $ attributes = array_first ( $ items , function ( $ i , $ attributes ) use ( $ model ) { if ( ! array_key_exists ( $ model -> getKeyName ( ) , $ attributes ) ) { return false ; } return $ attributes [ $ model -> getKeyName ( ) ] == $ model -> getKey ( ) ; } ) ; $ this -> validation ( ) -> validate ( 'update' , array_merge ( $ attributes , [ $ model -> getKeyName ( ) => $ model -> getKey ( ) ] ) ) ; $ model -> fill ( $ attributes ) ; $ model -> save ( ) ; } return $ models ; }
Update multiple models attributes in the storage.

@param  array  $items
@return \Illuminate\Database\Eloquent\Collection
Update multiple models attributes in the storage .