From c6cf2fe965fa02f609a15d60276ef74119b604a5 Mon Sep 17 00:00:00 2001 From: Patrick McCarren Date: Sun, 31 Aug 2014 22:02:41 -0400 Subject: [PATCH] Set the att value on the model once generated. This allows generators of the 'Closure' type to access attributes immediately after they are generated via the object that is passed in as the first paramater. --- src/Factory.php | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/Factory.php b/src/Factory.php index 7701551..c39d48a 100644 --- a/src/Factory.php +++ b/src/Factory.php @@ -334,11 +334,7 @@ private function make($model, array $attr, $save) } // Get the factory attributes for that model - $attributes = $this->attributesFor($object, $attr); - - foreach ($attributes as $name => $value) { - $this->setAttribute($object, $name, $value); - } + $this->attributesFor($object, $attr); return $object; } @@ -579,6 +575,7 @@ public function attributesFor($object, array $attr = array()) // Prepare attributes foreach ($attributes as $key => $kind) { $attr[$key] = $this->generateAttr($kind, $object); + $this->setAttribute($object, $key, $attr[$key]); } return $attr;