diff --git a/app/Console/Commands/DemoSeederCommand.php b/app/Console/Commands/DemoSeederCommand.php index 0994b3f4..111d1818 100644 --- a/app/Console/Commands/DemoSeederCommand.php +++ b/app/Console/Commands/DemoSeederCommand.php @@ -21,6 +21,8 @@ use CachetHQ\Cachet\Models\User; use DateInterval; use DateTime; use Illuminate\Console\Command; +use Illuminate\Console\ConfirmableTrait; +use Symfony\Component\Console\Input\InputOption; /** * This is the demo seeder command. @@ -29,6 +31,8 @@ use Illuminate\Console\Command; */ class DemoSeederCommand extends Command { + use ConfirmableTrait; + /** * The console command name. * @@ -50,6 +54,10 @@ class DemoSeederCommand extends Command */ public function fire() { + if (!$this->confirmToProceed()) { + return; + } + $this->seedComponentGroups(); $this->seedComponents(); $this->seedIncidents(); @@ -57,6 +65,8 @@ class DemoSeederCommand extends Command $this->seedMetrics(); $this->seedSettings(); $this->seedUsers(); + + $this->info('Database seeded with demo data successfully!'); } /** @@ -306,4 +316,16 @@ class DemoSeederCommand extends Command User::create($user); } } + + /** + * Get the console command options. + * + * @return array + */ + protected function getOptions() + { + return [ + ['force', null, InputOption::VALUE_NONE, 'Force the operation to run when in production.'], + ]; + } }