1 switch KEY OFF/ON for table before and after inserting 2 use \DB::insert() instead of \Eloquent
Why do you need to store it uing Eloquent? Yes, it's not the best approach, it will be time and resource consuming.
The best way would be inserting in chunks using simple insert
method:
foreach ($chunks as $chunk)
{
DB::table('your_table')->insert($chunk); // single insert query
}
If you have 1k rows to insert, I suppose you can do it in one go, but for more I would do it like above.
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community