Skip to content

Commit

Permalink
fix: avoid mass assignment
Browse files Browse the repository at this point in the history
  • Loading branch information
jaulz authored Jan 16, 2025
1 parent 90e80a9 commit 7888d8c
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/HasChildren.php
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,12 @@ protected function getChildModel(array $attributes)
$attributes[$this->getInheritanceColumn()]
);

return new $className((array) $attributes);
$childModel = new $className();

foreach ($attributes as $key => $value) {
$childModel->setAttribute($key, $value);
}

return $childModel;
}
}

0 comments on commit 7888d8c

Please sign in to comment.