Skip to content
Advertisement

“Action AppHttpControllersCommentRepliesController@createReply not defined” error on Laravel

I am trying to add an option to reply to comments on a post, but I keep getting that:

CommentRepliesController@createReply is not defined.

Adding a reply to a post through PostCommentsController@store works perfectly fine. But, when I try to add a reply to the comment by going back to the post or going directly to comment/reply in the URL, it gives me the error above.

Following is my route:

Following is my CommentRepliesController@createReply:

And following is my post.blade.php:

Thank you in advance.

Advertisement

Answer

Laravel resource routing assigns the typical “CRUD” routes to a controller with a single line of code.

Route::resource automatically uses the “CRUD” operations in your resource controller. See the docs here

If you want to use a specific function inside your controller, do not use Route::resource. Use whatever method you want. For example, if your method is POST use Route::post like this:

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement