Is the object saved or will be saved?
public isPendingOrSaved ( object $model ) : boolean | ||
$model | object | The model instance. |
return | boolean |
/** * 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); }
/** * Generate, and return the attribute. * * The value returned is the result of calling the callable. * * @return mixed */ public function generate() { $saved = $this->factoryMuffin->isPendingOrSaved($this->model); return call_user_func($this->kind, $this->model, $saved); }