Ejemplo n.º 1
0
 /**
  * Save the object to the database.
  *
  * @param object $object The model instance.
  *
  * @throws \League\FactoryMuffin\Exceptions\SaveFailedException
  *
  * @return void
  */
 private function persist($object)
 {
     if (!$this->save($object)) {
         if (isset($object->validationErrors) && $object->validationErrors) {
             throw new SaveFailedException(get_class($object), $object->validationErrors);
         }
         throw new SaveFailedException(get_class($object));
     }
     if (!$this->isSaved($object)) {
         Arr::move($this->pending, $this->saved, $object);
     }
 }