Skip to content

Commit

Permalink
Let the seeder call many commands at once. (#19912)
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasmichot authored and taylorotwell committed Jul 5, 2017
1 parent 0634c54 commit 94233bd
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions src/Illuminate/Database/Seeder.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,27 +25,32 @@ abstract class Seeder
/**
* Seed the given connection from the given path.
*
* @param string $class
* @param array|string $class
* @param bool $silent
* @return void
*/
public function call($class)
public function call($class, $silent = false)
{
if (isset($this->command)) {
$this->command->getOutput()->writeln("<info>Seeding:</info> $class");
}
$classes = is_array($class) ? $class : (array) $class;

$this->resolve($class)->__invoke();
foreach ($classes as $class) {
if ($silent === false && isset($this->command)) {
$this->command->getOutput()->writeln("<info>Seeding:</info> $class");
}

$this->resolve($class)->__invoke();
}
}

/**
* Silently seed the given connection from the given path.
*
* @param string $class
* @param array|string $class
* @return void
*/
public function callSilent($class)
{
$this->resolve($class)->__invoke();
$this->call($class, true);
}

/**
Expand Down

0 comments on commit 94233bd

Please sign in to comment.