Closed sobhanatar closed 7 years ago
As it seems you'd stopped answering to your question and for those that might gut stock in my situation can do the following to get a node object:
$ancestor = YourModelName::where('id', '=', $request->get('parent_id'))->first();
and after that create a child for this object using the way showed in documentation:
$ancestor->children()->create([...]);
Hi
How can I construct a node so I can make child for it using
$child2 = Category::create(['name' => 'Child 2']); $child2->makeChildOf($root);
I have sent
parent_id
from my view to my controller and my problem is that I can't find a way to create my$secondOrThirdLevelRootToBeFatherOfMyNewChild
In other words I want to know how can I get a
node
object from itsid
?Thanks