/**
* Make an instance of a model.
*
* @param string $name The model definition name.
* @param array $attr The model attributes.
* @param bool $save Are we saving, or just creating an instance?
*
* @return object
*/
protected function make($name, array $attr, $save)
{
$definition = $this->getDefinition($name);
$model = $this->makeClass($definition->getClass(), $definition->getMaker());
// Make the object as saved so that other generators persist correctly
if ($save) {
$this->store->markPending($model);
}
// Get the attribute definitions
$attributes = array_merge($this->getDefinition($name)->getDefinitions(), $attr);
// Generate and save each attribute for the model
$this->generate($model, $attributes);
return $model;
}