Skip to content

Commit 9e4a866

Browse files
committed
fix broken feature
1 parent ea4796e commit 9e4a866

File tree

2 files changed

+23
-11
lines changed

2 files changed

+23
-11
lines changed

src/Illuminate/Database/Seeder.php

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,14 @@ abstract class Seeder
2424
protected $command;
2525

2626
/**
27-
* Seed the given connection from the given path.
27+
* Run the given seeder class.
2828
*
2929
* @param array|string $class
3030
* @param bool $silent
31-
* @param mixed ...$parameters
31+
* @param array $parameters
3232
* @return $this
3333
*/
34-
public function call($class, $silent = false, ...$parameters)
34+
public function call($class, $silent = false, array $parameters = [])
3535
{
3636
$classes = Arr::wrap($class);
3737

@@ -46,7 +46,7 @@ public function call($class, $silent = false, ...$parameters)
4646

4747
$startTime = microtime(true);
4848

49-
$seeder->__invoke(...$parameters);
49+
$seeder->__invoke($parameters);
5050

5151
$runTime = number_format((microtime(true) - $startTime) * 1000, 2);
5252

@@ -59,15 +59,27 @@ public function call($class, $silent = false, ...$parameters)
5959
}
6060

6161
/**
62-
* Silently seed the given connection from the given path.
62+
* Run the given seeder class.
6363
*
6464
* @param array|string $class
65-
* @param mixed ...$parameters
65+
* @param array $parameters
6666
* @return void
6767
*/
68-
public function callSilent($class, ...$parameters)
68+
public function callWith($class, array $parameters = [])
6969
{
70-
$this->call($class, true, ...$parameters);
70+
$this->call($class, false, $parameters);
71+
}
72+
73+
/**
74+
* Silently run the given seeder class.
75+
*
76+
* @param array|string $class
77+
* @param array $parameters
78+
* @return void
79+
*/
80+
public function callSilent($class, array $parameters = [])
81+
{
82+
$this->call($class, true, $parameters);
7183
}
7284

7385
/**
@@ -122,12 +134,12 @@ public function setCommand(Command $command)
122134
/**
123135
* Run the database seeds.
124136
*
125-
* @param mixed ...$parameters
137+
* @param array $parameters
126138
* @return mixed
127139
*
128140
* @throws \InvalidArgumentException
129141
*/
130-
public function __invoke(...$parameters)
142+
public function __invoke(array $parameters = [])
131143
{
132144
if (! method_exists($this, 'run')) {
133145
throw new InvalidArgumentException('Method [run] missing from '.get_class($this));

tests/Database/DatabaseSeederTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ public function testSendParamsOnCallMethodWithDeps()
8787
$seeder = new TestDepsSeeder;
8888
$seeder->setContainer($container);
8989

90-
$seeder->__invoke('test1', 'test2');
90+
$seeder->__invoke(['test1', 'test2']);
9191

9292
$container->shouldHaveReceived('call')->once()->with([$seeder, 'run'], ['test1', 'test2']);
9393
}

0 commit comments

Comments
 (0)