From adbc26a6bd98e509ff2f9ae50ce338d44decad72 Mon Sep 17 00:00:00 2001 From: denisdulici Date: Tue, 10 Mar 2020 19:09:13 +0300 Subject: [PATCH] added progress bar --- database/seeds/SampleData.php | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/database/seeds/SampleData.php b/database/seeds/SampleData.php index 21af5cac1..7c15f855d 100755 --- a/database/seeds/SampleData.php +++ b/database/seeds/SampleData.php @@ -27,12 +27,35 @@ class SampleData extends Seeder $count = (int) $this->command->option('count'); $acc_count = ($count <= 10) ? $count : 10; + $this->command->info('Creating sample data...'); + + $bar = $this->command->getOutput()->createProgressBar(6); + $bar->setFormat('verbose'); + + $bar->start(); + factory(Contact::class, $count)->create(); + $bar->advance(); + factory(Category::class, $count)->create(); + $bar->advance(); + factory(Item::class, $count)->create(); + $bar->advance(); + factory(Account::class, $acc_count)->create(); + $bar->advance(); + factory(Bill::class, $count)->create(); + $bar->advance(); + factory(Invoice::class, $count)->create(); + $bar->advance(); + + $bar->finish(); + + $this->command->info(''); + $this->command->info('Sample data created.'); Model::unguard(); }