public function run() { $maxTypes = 10; $output = null; $faker = Faker::create(); if (isset($this->command)) { $output = $this->command->getOutput(); } // Initialize the progress bar $progress = $this->progressBarStart($output, $maxTypes); for ($i = 0; $i < $maxTypes; $i++) { do { //$type = $faker->safeColorName; $type = $faker->firstName; } while (LicenseType::where('type', $type)->first()); $status = $faker->randomElement([STATUS_ACTIVE, STATUS_ACTIVE, STATUS_ACTIVE, STATUS_PENDING, STATUS_PENDING, STATUS_EXPIRED]); // Create the record ... factory(LicenseType::class)->create(['type' => $type, 'name' => ucfirst($type) . ' License', 'status' => $status]); // ... and update the progress bar $this->progressBarAdvance($output, $progress); } // Close the progress bar $this->progressBarFinish($output, $progress); }