sabercode/laravel-batch-update

laravel批量更新mysql

Installs: 3

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 0

Open Issues: 0

Type:l

pkg:composer/sabercode/laravel-batch-update

v1.0.1 2021-10-22 06:42 UTC

This package is auto-updated.

Last update: 2025-12-22 15:51:14 UTC


README

环境要求

  • PHP > 7.0
  • composer > 2.0
  • laravel > 5.5

安装

composer require NephalemSaber/laravel-batchUpdate -vvv

使用

use Sabercode\LaravelBatchUpdate\BatchUpdate;
/*
 * string $table 表名
 * string $whereField 值不同条件字段名 如 id 
 * array $data 更新数据二维数组 必须包含条件字段 如
 * [
 *    ['id'=>1,'name'=>2,'age'=>3]
 *    ['id'=>2,'name'=>3,'age'=>4]
 * ]
 * array $whereSame 值相同条件字段数组一维数组 默认为空数组 如
 *    ['a'=>7,'b'=>'users']
 * */
BatchUpdate::doUpdate($table,$data,$whereField,$whereSame);

License

MIT