/** * Generate, and return the attribute. * * @return mixed */ public function generate() { $kind = $this->kind; $saved = FactoryMuffin::isPendingOrSaved($this->object); return $kind($this->object, $saved); }
/** * 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 $model Model class name. * * @return object */ protected function factory($model) { if (FactoryMuffin::isPendingOrSaved($this->object)) { return FactoryMuffin::create($model); } return FactoryMuffin::instance($model); }