raw([ 'business_id' => $business_id, ]); $business_workflows[] = ++$workflow_inc; for ($i=0; $i < rand(1, 4); $i++) { $statuses[] = factory(Status::class)->raw([ 'business_id' => $business_id, 'workflow_id' => $workflow_inc, ]); $status_inc++; } } // for ($i=0; $i < rand(1, 4); $i++) { // $statuses[] = factory(Status::class)->raw([ // 'business_id' => $business_id, // ]); // $status_inc++; // for ($ws=0; $ws < rand(0, count($business_workflows)); $ws++) { // $status_workflow[] = [ // 'status_id' => $status_inc, // 'workflow_id' => $business_workflows[rand(0, count($business_workflows)-1)], // 'order' => rand(0, 10) // ]; // } // } } DB::table('workflows')->insert($workflows); DB::table('statuses')->insert($statuses); // DB::table('status_workflow')->insert($status_workflow); } }