Skip to content

Commit

Permalink
[5.3] Allow chaining factory calls to define() and state() (laravel#1…
Browse files Browse the repository at this point in the history
  • Loading branch information
shadoWalker89 authored and Le Minh Tri committed Nov 16, 2016
1 parent 6967f0d commit 2c5adc8
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/Illuminate/Database/Eloquent/Factory.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public static function construct(Faker $faker, $pathToFactories = null)
* @param string $class
* @param string $name
* @param callable $attributes
* @return void
* @return $this
*/
public function defineAs($class, $name, callable $attributes)
{
Expand All @@ -73,11 +73,13 @@ public function defineAs($class, $name, callable $attributes)
* @param string $class
* @param callable $attributes
* @param string $name
* @return void
* @return $this
*/
public function define($class, callable $attributes, $name = 'default')
{
$this->definitions[$class][$name] = $attributes;

return $this;
}

/**
Expand All @@ -86,11 +88,13 @@ public function define($class, callable $attributes, $name = 'default')
* @param string $class
* @param string $state
* @param callable $attributes
* @return void
* @return $this
*/
public function state($class, $state, callable $attributes)
{
$this->states[$class][$state] = $attributes;

return $this;
}

/**
Expand Down

0 comments on commit 2c5adc8

Please sign in to comment.