From 524c5f5903f26a5449eb38994c480d42120d77e7 Mon Sep 17 00:00:00 2001 From: gwleuverink Date: Sat, 16 Aug 2025 00:23:10 +0200 Subject: [PATCH 1/2] add runtime command input --- src/Commands/SeedDatabaseCommand.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Commands/SeedDatabaseCommand.php b/src/Commands/SeedDatabaseCommand.php index cd56a20d..d6875877 100644 --- a/src/Commands/SeedDatabaseCommand.php +++ b/src/Commands/SeedDatabaseCommand.php @@ -16,6 +16,9 @@ class SeedDatabaseCommand extends BaseSeedCommand public function handle() { + $this->addOption('database', default: null); + $this->addArgument('class', default: 'DatabaseSeeder'); + (new NativeServiceProvider($this->laravel))->rewriteDatabase(); return parent::handle(); From abd8e3af69b85bf341e66b98c436b75199a3fb20 Mon Sep 17 00:00:00 2001 From: gwleuverink Date: Sat, 16 Aug 2025 08:42:15 +0200 Subject: [PATCH 2/2] make input symmetric with laravel seed command --- src/Commands/SeedDatabaseCommand.php | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/Commands/SeedDatabaseCommand.php b/src/Commands/SeedDatabaseCommand.php index d6875877..b0f20484 100644 --- a/src/Commands/SeedDatabaseCommand.php +++ b/src/Commands/SeedDatabaseCommand.php @@ -5,6 +5,8 @@ use Illuminate\Database\Console\Seeds\SeedCommand as BaseSeedCommand; use Native\Laravel\NativeServiceProvider; use Symfony\Component\Console\Attribute\AsCommand; +use Symfony\Component\Console\Input\InputArgument; +use Symfony\Component\Console\Input\InputOption; #[AsCommand( name: 'native:seed', @@ -14,10 +16,18 @@ class SeedDatabaseCommand extends BaseSeedCommand { protected $signature = 'native:seed'; + protected function configure(): void + { + parent::configure(); + + $this->addArgument('class', mode: InputArgument::OPTIONAL, description: 'The class name of the root seeder'); + $this->addOption('class', mode: InputOption::VALUE_OPTIONAL, description: 'The class name of the root seeder', default: 'Database\\Seeders\\DatabaseSeeder'); + } + public function handle() { - $this->addOption('database', default: null); - $this->addArgument('class', default: 'DatabaseSeeder'); + // Add the database option here so it won't show up in `--help` + $this->addOption('database', mode: InputOption::VALUE_REQUIRED, default: 'nativephp'); (new NativeServiceProvider($this->laravel))->rewriteDatabase();