delete child elements
This commit is contained in:
parent
ac0f404fce
commit
f4b42973cb
10 changed files with 271 additions and 17 deletions
|
|
@ -63,6 +63,18 @@ class EloquentElementRepository implements ElementRepository
|
|||
return $this->toDomain($model);
|
||||
}
|
||||
|
||||
public function delete(Element $element): void
|
||||
{
|
||||
$model = ElementModel::find($element->getId());
|
||||
if ($model === null) {
|
||||
throw new DomainException(
|
||||
"Element with id: {$element->getId()} doesnt exist"
|
||||
);
|
||||
}
|
||||
|
||||
$model->delete();
|
||||
}
|
||||
|
||||
public function find(int $id): ?Element
|
||||
{
|
||||
$model = ElementModel::find($id);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue