예제 #1
0
 /**
  * Associate the given model.
  * 
  * @param Record $instance
  * @return bool
  */
 public function associate(Record $instance)
 {
     $instance->save();
     $this->set(array($instance));
     $this->parent->set($this->foreignKey, $instance->id());
     return $this->parent->save();
 }
예제 #2
0
 /**
  * Save the given record to storage if it hasn't got an ID.
  * 
  * @param Record $instance
  */
 protected function persist(Record $instance)
 {
     if (!$instance->id()) {
         $instance->save();
     }
 }