business_id)->first(); $sprint = \App\Models\Sprint::where('business_id', $system->business_id)->first(); $creator = \App\Models\Business::find($system->business_id)->owners()->first(); array_push($tasks, [ 'title' => \Illuminate\Support\Str::random(5), 'business_id' => $system->business_id, 'project_id' => $system->project_id, 'system_id' => $system->id, 'workflow_id' => $status->workflow_id, 'status_id' => $status->id, 'sprint_id' => $sprint->id ?? null, 'creator_id' => $creator->id, ]); if (sizeof($tasks) == 100) { Task::insert($tasks); $tasks = []; } } } }