How To Add A Beautiful Delete Confirmation Message In Laravel

In our third tutorial in this series, we have added in our admin panel a delete button to delete one message. The problem here is that when we click on that button, it directly deletes the message without asking us to confirm the deletion. In this tutorial, we’ll add a beautiful confirmation message box to that button before deleting that entry.

This blog post is a part of a series that introduces you to the Laravel world by building a simple contact form protected by Google ReCaptcha and an admin panel to manage messages sent through our contact form.

To follow us along this tutorial, download the source code we produced in the previous tutorial here. We advise you to read the previous tutorial if you are confused because the dependencies we are using here have been added in the previous tutorial. By dependencies, I talk about JQuery and Sweetalert2.

The list-messages.blade.php view file

Open the file resources/views/list-messages.blade.php and add the following script to the script section.

Also, modify the delete button from the following code:

<form method="post" action="{{ url('/admin/messages/' . $message->id . '/delete') }}" style="display:inline">

    {{ method_field('DELETE') }}

     <button type='submit' class="btn btn-danger btn-sm">Delete</button>

To the following one:

<form method="post" class="delete-message"
 data-route="{{ url('/admin/messages/' . $message->id . '/delete') }}"
    <button type='submit' class="btn btn-danger btn-sm">Delete</button>

The app/Http/Controllers/ContactController.php file

To finish, modify the delete_message method from:

  public function delete_message($id)
        $message = Contact::find($id);

        if ($message) {
        return redirect('/admin/view-messages');


  public function delete_message($id)
        $message = Contact::find($id);

        if ($message) {
        return response('Message delete successfully', 200);


Start your development server with the command php artisan serve and try this feature in your admin panel


In this tutorial, we have explained how to add a beautiful confirmation delete message to our delete message buttons. If you encounter a problem at any step and need more explanation, just leave a comment below. The complete code for this tutorial is found here.

Subscribe To Our Newsletter

Receive our latest post directly in your inbox!

Invalid email address
Give it a try. You can unsubscribe at any time.

7 thoughts on “How To Add A Beautiful Delete Confirmation Message In Laravel

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top
porn by force indian girls fuck photos
kannada auntys sex videos indian local sex videos com
kolkata teen sex telugu xxx .com
gotporn indian men naked
m taxi 69 incent porn
indian awesome sex xnll
gand porn xnxx jabardasti mp3 hindi mp3
home sex malayalam indian sex vid
download indian girl sex video desi xvedios
ndiansex unexpected sex
xvideo plumber kannada real sex
sexy video rap poonam pandey xvideo
softcore 69
shemalexnxx desi choda video