Skip to content

chenfeizhou/laravel-model-bath-insert

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

laravel-model-batch-insert

Laravel 模型数据批量插入

使用指南

composer require chenfeizhou/laravel-model-batch-insert
php artisan vendor:publish --provider="Chenfeizhou\ModelBatch\ModelBatchServiceProvider"

使用

// 模型中引用
class Example extends Model
{
    use Chenfeizhou\ModelBatch\Model\Concerns\ModelBathInsertTrait;
}

$data = [
    [
      'name' => 'zhangsan',
      'age'  => '14'
    ],
    [
      'name' => 'lisi',
      'age'  => '15'
    ]
 ];

Example::batchInsert($data);

About

Laravel model bath insert

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages