Skip to content

Commit 158b830

Browse files
authored
Fix native:seed command (#680)
1 parent b2f7ce5 commit 158b830

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/Commands/SeedDatabaseCommand.php

Lines changed: 13 additions & 0 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,8 +16,19 @@ 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
{
29+
// Add the database option here so it won't show up in `--help`
30+
$this->addOption('database', mode: InputOption::VALUE_REQUIRED, default: 'nativephp');
31+
1932
(new NativeServiceProvider($this->laravel))->rewriteDatabase();
2033

2134
return parent::handle();

0 commit comments

Comments
 (0)