Skip to content

Commit abd8e3a

Browse files
committed
make input symmetric with laravel seed command
1 parent 524c5f5 commit abd8e3a

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

src/Commands/SeedDatabaseCommand.php

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
use Illuminate\Database\Console\Seeds\SeedCommand as BaseSeedCommand;
66
use Native\Laravel\NativeServiceProvider;
77
use Symfony\Component\Console\Attribute\AsCommand;
8+
use Symfony\Component\Console\Input\InputArgument;
9+
use Symfony\Component\Console\Input\InputOption;
810

911
#[AsCommand(
1012
name: 'native:seed',
@@ -14,10 +16,18 @@ class SeedDatabaseCommand extends BaseSeedCommand
1416
{
1517
protected $signature = 'native:seed';
1618

19+
protected function configure(): void
20+
{
21+
parent::configure();
22+
23+
$this->addArgument('class', mode: InputArgument::OPTIONAL, description: 'The class name of the root seeder');
24+
$this->addOption('class', mode: InputOption::VALUE_OPTIONAL, description: 'The class name of the root seeder', default: 'Database\\Seeders\\DatabaseSeeder');
25+
}
26+
1727
public function handle()
1828
{
19-
$this->addOption('database', default: null);
20-
$this->addArgument('class', default: 'DatabaseSeeder');
29+
// Add the database option here so it won't show up in `--help`
30+
$this->addOption('database', mode: InputOption::VALUE_REQUIRED, default: 'nativephp');
2131

2232
(new NativeServiceProvider($this->laravel))->rewriteDatabase();
2333

0 commit comments

Comments
 (0)