Improvements to demo data

This commit is contained in:
David Bomba 2020-07-20 08:04:52 +10:00
parent fec8e8b520
commit 867ae6435f
2 changed files with 34 additions and 30 deletions

View File

@ -92,7 +92,7 @@ class DemoMode extends Command
{
$faker = \Faker\Factory::create();
$this->count = 10;
$this->count = 50;
$this->info('Creating Small Account and Company');
@ -200,46 +200,46 @@ class DemoMode extends Command
{
$client = $company->clients->random();
$this->info('creating invoice for client #'.$client->id);
for($y=0; $y<($this->count); $y++){
$this->info("creating invoice #{$y} for client #".$client->id);
$this->info('creating entities for client #'.$client->id);
$this->createInvoice($client);
}
// for($y=0; $y<($this->count); $y++){
// $this->info("creating invoice #{$y} for client #".$client->id);
// }
$client = $company->clients->random();
for($y=0; $y<($this->count); $y++){
$this->info("creating credit #{$y} for client #".$client->id);
$this->createCredit($client);
}
// for($y=0; $y<($this->count); $y++){
// $this->info("creating credit #{$y} for client #".$client->id);
// }
$client = $company->clients->random();
for($y=0; $y<($this->count); $y++){
$this->info("creating quote #{$y} for client #".$client->id);
$this->createQuote($client);
}
// for($y=0; $y<($this->count); $y++){
// $this->info("creating quote #{$y} for client #".$client->id);
// }
$client = $company->clients->random();
$this->createExpense($client);
$this->info("creating expense for client #".$client->id);
$this->createExpense($client);
//$this->info("creating expense for client #".$client->id);
$client = $company->clients->random();
$this->info("creating vendor for client #".$client->id);
$this->createVendor($client);
$client = $company->clients->random();
// $this->info("creating vendor for client #".$client->id);
$this->info("creating task for client #".$client->id);
$client = $company->clients->random();
$this->createTask($client);
$client = $company->clients->random();
// $this->info("creating task for client #".$client->id);
$this->info("creating project for client #".$client->id);
$client = $company->clients->random();
$this->createProject($client);
// $this->info("creating project for client #".$client->id);
}
}
@ -446,12 +446,18 @@ class DemoMode extends Command
$quote =factory(\App\Models\Quote::class)->create(['user_id' => $client->user->id, 'company_id' => $client->company_id, 'client_id' => $client->id]);
if((bool)rand(0,1))
if((bool)rand(0,1)){
$dateable = Carbon::now()->subDays(rand(1, 30));
else
$dateable_due = $dateable->addDays(rand(1, 30));
}
else{
$dateable = Carbon::now()->addDays(rand(1, 30));
$dateable_due = $dateable->addDays(rand(-10, 30));
}
$quote->date = $dateable;
$quote->due_date = $dateable_due;
$quote->client_id = $client->id;
$quote->setRelation('client', $client);

View File

@ -15,14 +15,12 @@ $factory->define(App\Models\Quote::class, function (Faker $faker) {
'tax_rate2' => 17.5,
'tax_name3' => 'THIRDTAX',
'tax_rate3' => 5,
'custom_value1' => $faker->numberBetween(1, 4),
'custom_value2' => $faker->numberBetween(1, 4),
'custom_value3' => $faker->numberBetween(1, 4),
'custom_value4' => $faker->numberBetween(1, 4),
// 'custom_value1' => $faker->numberBetween(1, 4),
// 'custom_value2' => $faker->numberBetween(1, 4),
// 'custom_value3' => $faker->numberBetween(1, 4),
// 'custom_value4' => $faker->numberBetween(1, 4),
'is_deleted' => false,
'po_number' => $faker->text(10),
'date' => $faker->date(),
'due_date' => $faker->date(),
'line_items' => false,
];
});