You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

33 lines
1.1 KiB

<?php
use App\Models\Task;
use Illuminate\Database\Seeder;
class TaskTmpSeeder extends Seeder
{
public function run()
{
$systems = \App\Models\System::all();
$tasks = [];
foreach ($systems as $system) {
$status = \App\Models\Status::where('business_id', $system->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 = [];
}
}
}
}