Forked from marvinhosea/Laravel SweetAlert Confirm Delete
Created
March 27, 2019 14:29
-
-
Save moneya/8c08ff421557fdb8c11d42bacbea5ee6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Blade | |
<form id="delete-company" action="{{ route('company.destroy', $company->id) }}" method="post"> | |
{{csrf_field()}} | |
{{method_field('delete')}} | |
<button type="button" class="btn btn-xs btn-primary" data-toggle="modal" data-target="#agent{{$company->id}}">Edit</button> | |
<button type="button" class="btn btn-danger btn-xs" onclick="confirmDelete('delete-company')">delete</button> | |
</form> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
function confirmDelete(item_id) { | |
swal({ | |
title: "Are you sure?", | |
text: "Once deleted, you will not be able to recover it!", | |
icon: "warning", | |
buttons: true, | |
dangerMode: true, | |
}) | |
.then((willDelete) => { | |
if (willDelete) { | |
$('#'+item_id).submit(); | |
} else { | |
swal("Cancelled Successfully"); | |
} | |
}); | |
} | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment