pedram/multi-update 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

pedram/multi-update

Composer 安装命令:

composer require pedram/multi-update

包简介

README 文档

README

Multi-Update is a laravel package that allows you to update multiple rows in a database table with a single SQL statement. This package is useful when you need to update multiple rows with different values based on different conditions.

Installation

You can install Multi-Update using Composer.

composer require pedram/multi-update

Usage

To use Multi-Update, you need to call the updateMultipleRows method on a model or a query builder instance. This method takes two parameters: an array of fields and their corresponding values to update, and a variable-length argument list of conditions to apply to the update statement.

use PedramD\MultiUpdate\MultiUpdate;

MyModel::updateMultipleRows($params, $condition1, $condition2, ...);

Here's an example of how you can use Multi-Update to update multiple rows in a database table:

use PedramD\MultiUpdate\MultiUpdate;

MyModel::updateMultipleRows([
    'column1' => [
        'condition1' => 'value1',
        'condition2' => 'value2',
        'condition3' => 'value3',
    ],
    'column2' => [
        'condition4' => 'new_value',
    ],
], 'column5 > 0', 'column6 = "some_value"');

In the above example, we are updating two columns column1 and column2. The column1 is updated based on three different conditions, and the column2 is updated based on one condition. We have also added two additional conditions to apply to the update statement.

Contributing

Contributions to Multi-Update are welcome and encouraged! If you find a bug or have a feature request, please open an issue on the GitHub repository. If you would like to contribute code, please fork the repository and submit a pull request.

When submitting a pull request, please make sure to follow the PSR-2 coding standards for any new functionality or bug fixes.

License

Multi-Update is open-sourced software licensed under the MIT license.

统计信息

  • 总下载量: 7
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 2
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 2
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: Unknown
  • 更新时间: 2023-05-30