-
Notifications
You must be signed in to change notification settings - Fork 9
Open
Description
Currently we can already make a node a child of another node as such:
// Directly with a relation
$child1 = $root->children()->create(['name' => 'Child 1']);
// with the `makeChildOf` method
$child2 = Category::create(['name' => 'Child 2']);
$child2->makeChildOf($root);
It would be nice if we could call something like createAtPosition / makeChildAtPosition.
This way we can insert new nodes at the right place without needing to have knowledge about the siblings.
The package should then detect and move all existing nodes (+1 starting from the position)
For example:
Add node as the first child of its parent
$root->children()->createAtPosition(0, ['name' => 'Child 1']);
Add node as the third child of its parent
$root->children()->createAtPosition(2, ['name' => 'Child 3']);
Metadata
Metadata
Assignees
Labels
No labels