easydot/batch-update

v1.0.0 2023-01-06 12:26 UTC

This package is auto-updated.

Last update: 2024-09-12 01:30:07 UTC


README

在一个查询中更新批量行!

支持

laravel

安装

composer require easydot/batch-update

基本用法

(new UpdateBatch('table_name', $batchArrayData))->run();


# Specify primary key
(new UpdateBatch('table_name', $batchArrayData, 'primary_key'))->run();

# Add filter where
(new UpdateBatch('table_name', $batchArrayData, 'primary_key'))
    ->where('type', '=', $this->tmpOfferType)
    ->run();

# Support where
(new UpdateBatch('table_name', $batchArrayData, 'primary_key'))
    ->where('type', '=', $this->tmpOfferType)
    ->run();
    
# Support whereIn
(new UpdateBatch('table_name', $batchArrayData, 'primary_key'))
    ->whereIn('id', [1, 2, 3])
    ->run();
    
# Another methods
(new UpdateBatch('table_name'))
    ->multipleData($batchDataToUpdate)
    ->referenceColumn('primary_id')
    ->run();