承接 bmrbehnam/laravel-batch-update 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

bmrbehnam/laravel-batch-update

Composer 安装命令:

composer require bmrbehnam/laravel-batch-update

包简介

Batch update for Laravel

README 文档

README

this is a helper that by use this trait in models add Batch Update method in it.

this method run multi update query in one query.

How To Use It ?

  1. Install package by composer :

    composer require bmrbehnam/laravel-batch-update

2.Add this line in your model :

use BatchUpdate\BatchUpdateTrait;
  1. Ready ! use it :

     # Example data for update by one update query
     $data = [
         ['id' => 1, 'level' => 1, 'name' => 'category one'],
         ['id' => 2, 'level' => 2, 'name' => 'category two'],
         ['id' => 4, 'level' => 5, 'name' => 'category three'],
     ];
    

    Batch update

     Category::batchUpdate($data);
    
     # Or any model
     Post::batchUpdate($data);
    
    
     # Use by custom condition key by default condition key is model primary key field
    
     $data = [
         ['slug' => 'behnam', 'level' => 1, 'name' => 'category one'],
         ['slug' => 'nima', 'level' => 2, 'name' => 'category two'],
         ['slug' => 'hamed', 'level' => 5, 'name' => 'category three'],
     ];
    
     # Update level and name field in one query
     Category::batchUpdate($data,'slug');
    

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-02-01

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固