@@ 386-396 (lines=11) @@ | ||
383 | * @param Model $embed The embed to remove from the collection. |
|
384 | * @return self |
|
385 | */ |
|
386 | public function removeEmbed($key, Embed $embed) |
|
387 | { |
|
388 | if (false === $this->isEmbedHasMany($key)) { |
|
389 | return $this; |
|
390 | } |
|
391 | $this->touch(); |
|
392 | $collection = $this->hasManyEmbeds->get($key); |
|
393 | $collection->remove($embed); |
|
394 | $this->doDirtyCheck(); |
|
395 | return $this; |
|
396 | } |
|
397 | ||
398 | /** |
|
399 | * Rolls back a model to its original values. |
|
@@ 622-631 (lines=10) @@ | ||
619 | * @param Embed|null $embed The embed to relate. |
|
620 | * @return self |
|
621 | */ |
|
622 | protected function setEmbedHasOne($key, Embed $embed = null) |
|
623 | { |
|
624 | if (null !== $embed) { |
|
625 | $this->validateEmbedSet($key, $embed->getName()); |
|
626 | } |
|
627 | $this->touch(); |
|
628 | $this->hasOneEmbeds->set($key, $embed); |
|
629 | $this->doDirtyCheck(); |
|
630 | return $this; |
|
631 | } |
|
632 | ||
633 | /** |
|
634 | * Touches the model. |