2017 © Pedro Peláez
 

library eloquent-bulk-save

bulk insert multiple records using Eloquent Model.

image

n1215/eloquent-bulk-save

bulk insert multiple records using Eloquent Model.

  • Monday, July 2, 2018
  • by n1215
  • Repository
  • 0 Watchers
  • 0 Stars
  • 0 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

Eloquent Bulk Save

Latest Stable Version, (*1)

This library contains a trait that enables \Illuminate\Database\Eloquent\Model to bulk insert multiple records in one query. Unlike in the case of directly using \Illuminate\Database\Query\Builder::insert(), this trait method fires each eloquent model events like eloquent.creating, eloquent.saving, and so on., (*2)

Usage

// 1. change your eloquent model class to use the trait
class YouModel extends \Illuminate\Database\Eloquent\Model
{
    use \N1215\EloquentBulkSave\BulkInsert;
}

// 2. create model collection (you can also use Illuminate\Database\Eloquent\Collection)
$models = \Illuminate\Support\Collection::make([
    new YourModel($attributes1),
    new YourModel($attributes2),
    ...
]);

// 3. use bulkInsert() static method
YourModel::bulkInsert($models);

License

The MIT License (MIT). Please see LICENSE for more information., (*3)

The Versions

02/07 2018

dev-master

9999999-dev

bulk insert multiple records using Eloquent Model.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar n1215

02/07 2018

v0.1.0

0.1.0.0

bulk insert multiple records using Eloquent Model.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar n1215