|
|
@ -3,7 +3,6 @@ |
|
|
use App\Entities\Invoices\Invoice; |
|
|
use App\Entities\Invoices\Invoice; |
|
|
use App\Entities\Partners\Customer; |
|
|
use App\Entities\Partners\Customer; |
|
|
use App\Entities\Partners\Vendor; |
|
|
use App\Entities\Partners\Vendor; |
|
|
use App\Entities\Payments\Payment; |
|
|
|
|
|
use App\Entities\Projects\Feature; |
|
|
use App\Entities\Projects\Feature; |
|
|
use App\Entities\Projects\Project; |
|
|
use App\Entities\Projects\Project; |
|
|
use App\Entities\Projects\Task; |
|
|
use App\Entities\Projects\Task; |
|
|
@ -13,79 +12,59 @@ use App\Entities\Users\User; |
|
|
|
|
|
|
|
|
$factory->define(User::class, function (Faker\Generator $faker) { |
|
|
$factory->define(User::class, function (Faker\Generator $faker) { |
|
|
return [ |
|
|
return [ |
|
|
'name' => $faker->name, |
|
|
|
|
|
'email' => $faker->unique()->email, |
|
|
|
|
|
'password' => 'member', |
|
|
|
|
|
|
|
|
'name' => $faker->name, |
|
|
|
|
|
'email' => $faker->unique()->email, |
|
|
|
|
|
'password' => 'member', |
|
|
'remember_token' => str_random(10), |
|
|
'remember_token' => str_random(10), |
|
|
'api_token' => str_random(40), |
|
|
|
|
|
|
|
|
'api_token' => str_random(40), |
|
|
]; |
|
|
]; |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
$factory->define(Project::class, function (Faker\Generator $faker) { |
|
|
$factory->define(Project::class, function (Faker\Generator $faker) { |
|
|
|
|
|
|
|
|
$proposalDate = $faker->dateTimeBetween('-1 year', '-1 month')->format('Y-m-d'); |
|
|
$proposalDate = $faker->dateTimeBetween('-1 year', '-1 month')->format('Y-m-d'); |
|
|
$startDate = Carbon::parse($proposalDate)->addDays(10); |
|
|
|
|
|
$endDate = $startDate->addDays(rand(1, 13) * 7); |
|
|
|
|
|
|
|
|
$startDate = Carbon::parse($proposalDate)->addDays(10); |
|
|
|
|
|
$endDate = $startDate->addDays(rand(1, 13) * 7); |
|
|
|
|
|
|
|
|
return [ |
|
|
return [ |
|
|
'name' => $faker->sentence(3), |
|
|
|
|
|
'description' => $faker->paragraph, |
|
|
|
|
|
'proposal_date' => $proposalDate, |
|
|
|
|
|
'start_date' => $startDate->format('Y-m-d'), |
|
|
|
|
|
'end_date' => $endDate->format('Y-m-d'), |
|
|
|
|
|
'project_value' => $projectValue = rand(1, 10) * 500000, |
|
|
|
|
|
|
|
|
'name' => $faker->sentence(3), |
|
|
|
|
|
'description' => $faker->paragraph, |
|
|
|
|
|
'proposal_date' => $proposalDate, |
|
|
|
|
|
'start_date' => $startDate->format('Y-m-d'), |
|
|
|
|
|
'end_date' => $endDate->format('Y-m-d'), |
|
|
|
|
|
'project_value' => $projectValue = rand(1, 10) * 500000, |
|
|
'proposal_value' => $projectValue, |
|
|
'proposal_value' => $projectValue, |
|
|
'status_id' => rand(1, 6), |
|
|
|
|
|
'owner_id' => function () { |
|
|
|
|
|
|
|
|
'status_id' => rand(1, 6), |
|
|
|
|
|
'owner_id' => function () { |
|
|
return factory(User::class)->create()->id; |
|
|
return factory(User::class)->create()->id; |
|
|
}, |
|
|
}, |
|
|
'customer_id' => function () { |
|
|
|
|
|
|
|
|
'customer_id' => function () { |
|
|
return factory(Customer::class)->create()->id; |
|
|
return factory(Customer::class)->create()->id; |
|
|
}, |
|
|
}, |
|
|
]; |
|
|
]; |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
$factory->define(Payment::class, function (Faker\Generator $faker) { |
|
|
|
|
|
|
|
|
|
|
|
return [ |
|
|
|
|
|
'project_id' => function () { |
|
|
|
|
|
return factory(Project::class)->create()->id; |
|
|
|
|
|
}, |
|
|
|
|
|
'amount' => rand(1, 5) * 500000, |
|
|
|
|
|
'in_out' => rand(0, 1), |
|
|
|
|
|
'type_id' => rand(1, 3), |
|
|
|
|
|
'date' => $faker->dateTimeBetween('-1 year', '-1 month')->format('Y-m-d'), |
|
|
|
|
|
'description' => $faker->paragraph, |
|
|
|
|
|
'owner_id' => function () { |
|
|
|
|
|
return factory(User::class)->create()->id; |
|
|
|
|
|
}, |
|
|
|
|
|
'customer_id' => function () { |
|
|
|
|
|
return factory(User::class)->create()->id; |
|
|
|
|
|
}, |
|
|
|
|
|
]; |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
$factory->define(Subscription::class, function (Faker\Generator $faker) { |
|
|
$factory->define(Subscription::class, function (Faker\Generator $faker) { |
|
|
|
|
|
|
|
|
$startDate = Carbon::parse($faker->dateTimeBetween('-1 year', '-1 month')->format('Y-m-d')); |
|
|
$startDate = Carbon::parse($faker->dateTimeBetween('-1 year', '-1 month')->format('Y-m-d')); |
|
|
|
|
|
|
|
|
return [ |
|
|
return [ |
|
|
'project_id' => function () { |
|
|
|
|
|
|
|
|
'project_id' => function () { |
|
|
return factory(Project::class)->create()->id; |
|
|
return factory(Project::class)->create()->id; |
|
|
}, |
|
|
}, |
|
|
'status_id' => 1, |
|
|
|
|
|
'domain_name' => 'www.'.str_random(10).'.com', |
|
|
|
|
|
'domain_price' => 125000, |
|
|
|
|
|
'epp_code' => str_random(10), |
|
|
|
|
|
|
|
|
'status_id' => 1, |
|
|
|
|
|
'domain_name' => 'www.'.str_random(10).'.com', |
|
|
|
|
|
'domain_price' => 125000, |
|
|
|
|
|
'epp_code' => str_random(10), |
|
|
'hosting_capacity' => rand(1, 3).' GB', |
|
|
'hosting_capacity' => rand(1, 3).' GB', |
|
|
'hosting_price' => rand(1, 5) * 100000, |
|
|
|
|
|
'start_date' => $startDate->format('Y-m-d'), |
|
|
|
|
|
'due_date' => $startDate->addYears(1)->format('Y-m-d'), |
|
|
|
|
|
'remark' => $faker->paragraph, |
|
|
|
|
|
'customer_id' => function () { |
|
|
|
|
|
|
|
|
'hosting_price' => rand(1, 5) * 100000, |
|
|
|
|
|
'start_date' => $startDate->format('Y-m-d'), |
|
|
|
|
|
'due_date' => $startDate->addYears(1)->format('Y-m-d'), |
|
|
|
|
|
'remark' => $faker->paragraph, |
|
|
|
|
|
'customer_id' => function () { |
|
|
return factory(Customer::class)->create()->id; |
|
|
return factory(Customer::class)->create()->id; |
|
|
}, |
|
|
}, |
|
|
'vendor_id' => function () { |
|
|
|
|
|
|
|
|
'vendor_id' => function () { |
|
|
return factory(Vendor::class)->create()->id; |
|
|
return factory(Vendor::class)->create()->id; |
|
|
}, |
|
|
}, |
|
|
]; |
|
|
]; |
|
|
@ -94,48 +73,48 @@ $factory->define(Subscription::class, function (Faker\Generator $faker) { |
|
|
$factory->define(Feature::class, function (Faker\Generator $faker) { |
|
|
$factory->define(Feature::class, function (Faker\Generator $faker) { |
|
|
|
|
|
|
|
|
return [ |
|
|
return [ |
|
|
'project_id' => function () { |
|
|
|
|
|
|
|
|
'project_id' => function () { |
|
|
return factory(Project::class)->create()->id; |
|
|
return factory(Project::class)->create()->id; |
|
|
}, |
|
|
}, |
|
|
'name' => $faker->sentence(3), |
|
|
|
|
|
'price' => rand(1, 10) * 100000, |
|
|
|
|
|
|
|
|
'name' => $faker->sentence(3), |
|
|
|
|
|
'price' => rand(1, 10) * 100000, |
|
|
'description' => $faker->paragraph, |
|
|
'description' => $faker->paragraph, |
|
|
'worker_id' => function () { |
|
|
|
|
|
|
|
|
'worker_id' => function () { |
|
|
return factory(User::class)->create()->id; |
|
|
return factory(User::class)->create()->id; |
|
|
}, |
|
|
}, |
|
|
'type_id' => 1, // Main feature
|
|
|
|
|
|
'position' => rand(1, 10), |
|
|
|
|
|
|
|
|
'type_id' => 1, // Main feature
|
|
|
|
|
|
'position' => rand(1, 10), |
|
|
]; |
|
|
]; |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
$factory->define(Task::class, function (Faker\Generator $faker) { |
|
|
$factory->define(Task::class, function (Faker\Generator $faker) { |
|
|
|
|
|
|
|
|
return [ |
|
|
return [ |
|
|
'feature_id' => function () { |
|
|
|
|
|
|
|
|
'feature_id' => function () { |
|
|
return factory(Feature::class)->create()->id; |
|
|
return factory(Feature::class)->create()->id; |
|
|
}, |
|
|
}, |
|
|
'name' => $faker->sentence(3), |
|
|
|
|
|
|
|
|
'name' => $faker->sentence(3), |
|
|
'description' => $faker->paragraph, |
|
|
'description' => $faker->paragraph, |
|
|
'progress' => rand(40, 100), |
|
|
|
|
|
'route_name' => implode('.', $faker->words(3)), |
|
|
|
|
|
'position' => rand(1, 10), |
|
|
|
|
|
|
|
|
'progress' => rand(40, 100), |
|
|
|
|
|
'route_name' => implode('.', $faker->words(3)), |
|
|
|
|
|
'position' => rand(1, 10), |
|
|
]; |
|
|
]; |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
$factory->define(Event::class, function (Faker\Generator $faker) { |
|
|
$factory->define(Event::class, function (Faker\Generator $faker) { |
|
|
|
|
|
|
|
|
return [ |
|
|
return [ |
|
|
'user_id' => function () { |
|
|
|
|
|
|
|
|
'user_id' => function () { |
|
|
return factory(User::class)->create()->id; |
|
|
return factory(User::class)->create()->id; |
|
|
}, |
|
|
}, |
|
|
'project_id' => function () { |
|
|
'project_id' => function () { |
|
|
return factory(Project::class)->create()->id; |
|
|
return factory(Project::class)->create()->id; |
|
|
}, |
|
|
}, |
|
|
'title' => $faker->words(rand(2, 4), true), |
|
|
|
|
|
'body' => $faker->sentence, |
|
|
|
|
|
'start' => $faker->dateTimeBetween('-2 months', '-2 months')->format('Y-m-d H:i:s'), |
|
|
|
|
|
'end' => $faker->dateTimeBetween('-2 months', '-2 months')->format('Y-m-d H:i:s'), |
|
|
|
|
|
'is_allday' => rand(0, 1), |
|
|
|
|
|
|
|
|
'title' => $faker->words(rand(2, 4), true), |
|
|
|
|
|
'body' => $faker->sentence, |
|
|
|
|
|
'start' => $faker->dateTimeBetween('-2 months', '-2 months')->format('Y-m-d H:i:s'), |
|
|
|
|
|
'end' => $faker->dateTimeBetween('-2 months', '-2 months')->format('Y-m-d H:i:s'), |
|
|
|
|
|
'is_allday' => rand(0, 1), |
|
|
]; |
|
|
]; |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
@ -145,11 +124,11 @@ $factory->define(Invoice::class, function (Faker\Generator $faker) { |
|
|
'project_id' => function () { |
|
|
'project_id' => function () { |
|
|
return factory(Project::class)->create()->id; |
|
|
return factory(Project::class)->create()->id; |
|
|
}, |
|
|
}, |
|
|
'number' => $invoice->generateNewNumber(), |
|
|
|
|
|
'items' => [], |
|
|
|
|
|
'amount' => 100000, |
|
|
|
|
|
'notes' => $faker->paragraph, |
|
|
|
|
|
'status_id' => 1, |
|
|
|
|
|
'user_id' => 1, |
|
|
|
|
|
|
|
|
'number' => $invoice->generateNewNumber(), |
|
|
|
|
|
'items' => [], |
|
|
|
|
|
'amount' => 100000, |
|
|
|
|
|
'notes' => $faker->paragraph, |
|
|
|
|
|
'status_id' => 1, |
|
|
|
|
|
'user_id' => 1, |
|
|
]; |
|
|
]; |
|
|
}); |
|
|
}); |