src/FactoryMuffin.php
protected function generate($model, array $attr = [])
    {
        foreach ($attr as $key => $kind) {
            $value = $this->factory->generate($kind, $model, $this);

            $setter = 'set'.ucfirst(static::camelize($key));

            // check if there is a setter and use it instead
            if (method_exists($model, $setter) && is_callable([$model, $setter])) {
                $model->$setter($value);
            } else {
                $model->$key = $value;
            }
        }
    }
protected function generate($model, array $attr = [])
    {
        foreach ($attr as $key => $kind) {
            $value = $this->factory->generate($kind, $model, $this);

            $setter = 'set'.ucfirst(static::camelize($key));

            // check if there is a setter and use it instead
            if (method_exists($model, $setter) && is_callable([$model, $setter])) {
                $model->$setter($value);
            } else {
                $model->$key = $value;
            }
        }
    }
protected function generate ( $ model , array $ attr = [ ] ) { foreach ( $ attr as $ key => $ kind ) { $ value = $ this -> factory -> generate ( $ kind , $ model , $ this ) ; $ setter = 'set' . ucfirst ( static :: camelize ( $ key ) ) ; // check if there is a setter and use it instead if ( method_exists ( $ model , $ setter ) && is_callable ( [ $ model , $ setter ] ) ) { $ model -> $ setter ( $ value ) ; } else { $ model -> $ key = $ value ; } } }
Generate and set the model attributes.

@param object $model The model instance.
@param array  $attr  The model attributes.

@return void
Generate and set the model attributes .