Support the ongoing development of →
Blade Forms Laravel
Last updated by @ajax30 5 months ago.

@ajax30 You are deleting the comment first and then you are trying to delete replies of comment which you have already deleted.

Here is the updated delete comment function function

public function delete_comment($id) {
    $comment = Comment::find($id);

    if($comment->user_id === auth()->user()->id) {
      return redirect()->back()->with('success', 'The comment was deleted');

I assume you have already created a hasMany relationship of replies in the Comment modal.


ajax30 liked this reply

Solution selected by @ajax30

Please try answering this question too. Thanks!

(Link removed)

Last updated by @tvbeek 6 months ago.

@ajax30 people can answer other questions if they have the time and know the answer. It is not wanted to ask them from one thread to answer another one.

Last updated by @tvbeek 6 months ago.

Please consider posting an answer to this question too. Thanks!

(mention and link removed)

Last updated by @tvbeek 5 months ago.

@ajax30 as mentioned earlier please don't ask people to answer other threads. They will see it if they have time.

If they are 100% related I can understand it but that isn't the case.

I hope this is clear to you now :)


Sign in to participate in this thread!


Your banner here too?

Razvan ajax30 Joined 2 Oct 2021


We'd like to thank these amazing companies for supporting us

Your logo here?

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 - All rights reserved.