src/CommentsController.php
public function reply(Request $request, Comment $comment)
    {
        $this->authorize('reply-to-comment', $comment);

        $this->validate($request, [
            'message' => 'required|string'
        ]);

        $reply = new Comment;
        $reply->commenter()->associate(auth()->user());
        $reply->commentable()->associate($comment->commentable);
        $reply->parent()->associate($comment);
        $reply->comment = $request->message;
        $reply->save();

        return redirect()->to(url()->previous() . '#comment-' . $reply->id);
    }
public function reply(Request $request, Comment $comment)
    {
        $this->authorize('reply-to-comment', $comment);

        $this->validate($request, [
            'message' => 'required|string'
        ]);

        $reply = new Comment;
        $reply->commenter()->associate(auth()->user());
        $reply->commentable()->associate($comment->commentable);
        $reply->parent()->associate($comment);
        $reply->comment = $request->message;
        $reply->save();

        return redirect()->to(url()->previous() . '#comment-' . $reply->id);
    }
public function reply ( Request $ request , Comment $ comment ) { $ this -> authorize ( 'reply-to-comment' , $ comment ) ; $ this -> validate ( $ request , [ 'message' => 'required|string' ] ) ; $ reply = new Comment ; $ reply -> commenter ( ) -> associate ( auth ( ) -> user ( ) ) ; $ reply -> commentable ( ) -> associate ( $ comment -> commentable ) ; $ reply -> parent ( ) -> associate ( $ comment ) ; $ reply -> comment = $ request -> message ; $ reply -> save ( ) ; return redirect ( ) -> to ( url ( ) -> previous ( ) . '#comment-' . $ reply -> id ) ; }
Creates a reply "comment" to a comment.
Creates a reply comment to a comment .