0

I am using laraadmin in one of my application but module generated by admin not confirming when deleting any record. Please some one help me How to add delete confirmation in laraadmin modules?

1 Answer 1

1

I do not know how to work with laraadmin but You can do that by java script:

Blade:

@foreach (items as item)
    <form class="delete" action="{{ route('item.destroy', $item->id) }}" method="POST">
        <input type="hidden" name="_method" value="DELETE">
        <input type="hidden" name="_token" value="{{ csrf_token() }}" />
        <input type="submit" value="Delete">
    </form>
@endforeach

JS:

<script>
    $(".delete").on("submit", function(){
        return confirm("Do you want to delete this item?");
    });
</script>

And if you need preety nice confirmation design You can use Sweet Alert JS Library: https://sweetalert.js.org/guides/

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks @Adam It helps me a lot and save time. Its working perfect.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.