I have a system of commenting models driven by the Laralvel-Commentable package
Unfortunately I am underskilled in PHP for the job of implementing nested comments (replies).
Problem : adding a reply:
When I used hints from this thread: Laravel 5: how to do multi threaded comments
And added this code to the create method:
$object = Lead::find($input['item_id']);
$comment = new Comment;
$comment->body = $input['comment'];
$comment->user_id = Auth::id();
// added section
if(isset($input['parent_id'])) {
$comment->makeChildOf($input['parent_id']);
}
// end of added section
$object->comments()->save($comment);
Note: in the reply form I have a hidden input
{!! Form::hidden('parent_id', $o->id) !!}
After submitting the form I get this error:
MoveNotPossibleException in Move.php line 198: A new node cannot be moved.