Looking to hire Laravel developers? Try LaraJobs

laravel-model-batch-insert maintained by chenfeizhou

Description
Laravel 模型批量插入
Author
Last update
2022/05/27 12:35 (dev-master)
License
Links
Downloads
0

Comments
comments powered by Disqus

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);