Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save moneya/8c08ff421557fdb8c11d42bacbea5ee6 to your computer and use it in GitHub Desktop.
Save moneya/8c08ff421557fdb8c11d42bacbea5ee6 to your computer and use it in GitHub Desktop.
#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>
<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