Answer the question
In order to leave comments, you need to log in
How to load more than 500 entries in the seeder?
Good day, a question arose, ran into the border of 500 records during seeding. I read that this is a restriction at the Mysql level, not lara. I decided that it is possible to load data in chunks, i.e. using transactions. I made this code,
try
{
DB::beginTransaction();
for($i=1;$i<=6;$i++)
{
for ($b = 1; $b<=4;$b++)
{
$t = $group->subgroups()->get()->random();
\App\Models\Schedule::create([
'week' => $week,
'day_of_week' => $i,
'city_id' => 1,
'group_id' => $group->id,
'corps_id' => $group->corps_id,
'discipline_id' => $t->discipline_id,
'teacher_id' => $t->teacher_id,
'rooms' => rand(10,350),
'lesson_priority' => $b,
]);
}
}
DB::commit();
}
catch (\Exception $exception)
{
DB::rollBack();
}
Answer the question
In order to leave comments, you need to log in
HZ, but maybe you are doing something wrong. I did a sider and 100 thousand. records without any restrictions
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question