Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions src/Commands/SeedDatabaseCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -14,8 +16,19 @@ 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()
{
// 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();

return parent::handle();
Expand Down
Loading