From b063f3b740cd108cf9182a4f52c342110e78e0ac Mon Sep 17 00:00:00 2001 From: Melek REBAI Date: Sun, 13 Nov 2016 13:28:11 +0100 Subject: [PATCH] [5.3] Allow chaining factory calls to define() and state() --- src/Illuminate/Database/Eloquent/Factory.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/Illuminate/Database/Eloquent/Factory.php b/src/Illuminate/Database/Eloquent/Factory.php index fd6d4be7f78c..97cb1329c9ce 100644 --- a/src/Illuminate/Database/Eloquent/Factory.php +++ b/src/Illuminate/Database/Eloquent/Factory.php @@ -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) { @@ -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; } /** @@ -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; } /**