Reputation: 587
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?
Upvotes: 0
Views: 273
Reputation: 5896
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/
Upvotes: 1