Skip to content

Commit 0443f1c

Browse files
Add class argument (#36513)
1 parent 37e48ba commit 0443f1c

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

src/Illuminate/Database/Console/Seeds/SeedCommand.php

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
use Illuminate\Console\ConfirmableTrait;
77
use Illuminate\Database\ConnectionResolverInterface as Resolver;
88
use Illuminate\Database\Eloquent\Model;
9+
use Symfony\Component\Console\Input\InputArgument;
910
use Symfony\Component\Console\Input\InputOption;
1011

1112
class SeedCommand extends Command
@@ -81,7 +82,7 @@ public function handle()
8182
*/
8283
protected function getSeeder()
8384
{
84-
$class = $this->input->getOption('class');
85+
$class = $this->input->getArgument('class') ?? $this->input->getOption('class');
8586

8687
if (strpos($class, '\\') === false) {
8788
$class = 'Database\\Seeders\\'.$class;
@@ -109,6 +110,18 @@ protected function getDatabase()
109110
return $database ?: $this->laravel['config']['database.default'];
110111
}
111112

113+
/**
114+
* Get the console command arguments.
115+
*
116+
* @return array
117+
*/
118+
protected function getArguments()
119+
{
120+
return [
121+
['class', InputArgument::OPTIONAL, 'The class name of the root seeder', null],
122+
];
123+
}
124+
112125
/**
113126
* Get the console command options.
114127
*

0 commit comments

Comments
 (0)