Seed multiple rows at once laravel 5

If you have to use the model you need a loop:

foreach($users as $user){
    User::create($user);
}

Otherwise you can just use DB::table() and insert:

DB::table('users')->insert($users);

Actually you can also call insert() on the model (the resulting query is the same)

User::insert($users);

Note if you choose the insert method you loose special Eloquent functionality such as timestamps and model events.

Leave a Comment