Skip to content

Commit

Permalink
feat: add toChildModel method
Browse files Browse the repository at this point in the history
  • Loading branch information
jaulz authored Dec 17, 2024
1 parent 90e80a9 commit 2ed663d
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/HasChildren.php
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,16 @@ public function getChildTypes(): array
return [];
}

/**
* Create a child model from the current instance.
*
* @return static
*/
public function toChildModel(): self
{
return $this->newInstance($this->getAttributes(), $this->exists);
}

/**
* @return mixed
*/
Expand Down

0 comments on commit 2ed663d

Please sign in to comment.