League\FactoryMuffin\FactoryMuffin::instance PHP Метод

instance() публичный Метод

This does not save it in the database. Use create for that.
public instance ( string $name, array $attr = [] ) : object
$name string The model definition name.
$attr array The model attributes.
Результат object
    public function instance($name, array $attr = [])
    {
        $model = $this->make($name, $attr, false);
        $this->triggerCallback($model, $name);
        return $model;
    }

Usage Example

Пример #1
0
 /**
  * Create an instance of the model.
  *
  * This model will be automatically saved to the database if the model we
  * are generating it for has been saved (the create function was used).
  *
  * @param string $name The model definition name.
  *
  * @return object
  */
 private function factory($name)
 {
     if ($this->factoryMuffin->isPendingOrSaved($this->model)) {
         return $this->factoryMuffin->create($name);
     }
     return $this->factoryMuffin->instance($name);
 }