In this video, we are going to create a controller to delete a comment.
So let's get into the comment controller, which is this one, and let's locate the dummy controller.
Which is this the step going to be the same as deleting a post?
So let's get into the post and let's copy the logic and here is the logic.
Let's select everything inside the try and let's get into the command and let's look at the delete,
which is this, and I'm going to replace with the one I copied.
So here we are going to find the command.
So I'm going to be the comment module instead of post.
And that and I would change this one to comment.
And next step is we are going to find if the user who is deleting is the owner of the comment going
to be as the comment here as that and the message would be you are not allowed to delete this comment.
Perfect.
And lastly, let's go ahead and then delete.
So I'm going to be the comment model.
And the message would be comment has been deleted successfully.
The next step is let's put this controller behind authentication so routes comment and then here we
go.
Let's look at the delete, which is this, and let me provide the protected.
So it's time to test so inside the tender client.
So let's find all the comments.
So here is a comment and this one is great.
So let's go ahead and delete this one.
So I'll copy the ID of this comment, which is this and this is a delete handler and our paste the ID
here and let's hit send.
And comment has been deleted successfully.
All right.
In this video, let's see how we can update a comment.