Skip to content

Commit fd81a09

Browse files
committed
Add options to seed default data command
1 parent a0314b5 commit fd81a09

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

src/Commands/SeedDefaultsCommand.php

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,10 @@ class SeedDefaultsCommand extends Command
1515
*
1616
* @var string
1717
*/
18-
protected $signature = 'flexible-content-block-pages:seed';
18+
protected $signature = 'flexible-content-block-pages:seed
19+
{--only-home-page : Only seed the home page}
20+
{--only-settings : Only seed the settings}
21+
{--only-tag-types : Only seed the tag types}';
1922

2023
/**
2124
* The console command description.
@@ -31,9 +34,17 @@ public function handle(): void
3134
{
3235
$this->info('Seeding default home page and settings...');
3336

34-
$this->seedHomePage();
35-
$this->seedSettings();
36-
$this->seedTagTypes();
37+
$noOptions = ! $this->hasOption('only-home-page') && ! $this->hasOption('only-settings') && ! $this->hasOption('only-tag-types');
38+
39+
if ($noOptions || $this->hasOption('only-home-page')) {
40+
$this->seedHomePage();
41+
}
42+
if ($noOptions || $this->hasOption('only-settings')) {
43+
$this->seedSettings();
44+
}
45+
if ($noOptions || $this->hasOption('only-tag-types')) {
46+
$this->seedTagTypes();
47+
}
3748

3849
$this->info('Default home page and settings seeded successfully!');
3950
}

0 commit comments

Comments
 (0)