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.
50 lines
1.7 KiB
50 lines
1.7 KiB
<?php
|
|
|
|
use App\Models\Status;
|
|
use App\Models\Workflow;
|
|
use Illuminate\Database\Seeder;
|
|
use Illuminate\Support\Facades\DB;
|
|
|
|
class WorkflowSeeder extends Seeder
|
|
{
|
|
public function run()
|
|
{
|
|
$workflow_inc = 0;
|
|
$status_inc = 0;
|
|
$workflows = [];
|
|
$statuses = [];
|
|
// $status_workflow = [];
|
|
for ($business_id=1; $business_id <= 2000; $business_id++) {
|
|
$business_workflows = [];
|
|
for ($i=0; $i < rand(1, 4); $i++) {
|
|
$workflows[] = factory(Workflow::class)->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);
|
|
}
|
|
}
|