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