Skip to content

Commit

Permalink
Change class option to argument
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonmccreary committed Dec 8, 2020
1 parent 7620a54 commit d660c62
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions src/Illuminate/Database/Console/Seeds/SeedCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
use Illuminate\Console\ConfirmableTrait;
use Illuminate\Database\ConnectionResolverInterface as Resolver;
use Illuminate\Database\Eloquent\Model;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputOption;

class SeedCommand extends Command
Expand Down Expand Up @@ -90,7 +91,7 @@ public function handle()
*/
protected function getSeeder()
{
$class = $this->input->getOption('class');
$class = $this->input->getArgument('class');

if (strpos($class, '\\') === false) {
$class = 'Database\\Seeders\\'.$class;
Expand Down Expand Up @@ -118,6 +119,18 @@ protected function getDatabase()
return $database ?: $this->laravel['config']['database.default'];
}

/**
* Get the console command arguments.
*
* @return array
*/
protected function getArguments()
{
return [
['class', InputArgument::OPTIONAL, 'The class name of the root seeder', 'Database\\Seeders\\DatabaseSeeder'],
];
}

/**
* Get the console command options.
*
Expand All @@ -126,7 +139,6 @@ protected function getDatabase()
protected function getOptions()
{
return [
['class', null, InputOption::VALUE_OPTIONAL, 'The class name of the root seeder', 'Database\\Seeders\\DatabaseSeeder'],
['database', null, InputOption::VALUE_OPTIONAL, 'The database connection to seed'],
['force', null, InputOption::VALUE_NONE, 'Force the operation to run when in production'],
];
Expand Down

0 comments on commit d660c62

Please sign in to comment.