예제 #1
0
 /**
  * @param array $attributes
  * @return \Notadd\Foundation\Database\Eloquent\Model
  */
 protected function makeInstance(array $attributes = [])
 {
     return Model::unguarded(function () use($attributes) {
         if (!isset($this->definitions[$this->class][$this->name])) {
             throw new InvalidArgumentException("Unable to locate factory with name [{$this->name}] [{$this->class}].");
         }
         $definition = call_user_func($this->definitions[$this->class][$this->name], $this->faker, $attributes);
         return new $this->class(array_merge($definition, $attributes));
     });
 }