delete form data using anchor tag

 


<a href="{{ route('products.destroy',$product->id}}"

    onclick="event.preventDefault(); document.getElementById('delete-form').submit();">

    <i class="fa fa-trash btn btn-sm btn-danger mr-2" aria-hidden="true"></i>
</a>
<form id="delete-form" action="{{ route('products.destroy',$product->id}}" 
       method="POST" style="display: none;">
                             @csrf
                             @method('DELETE')
</form>

Post a Comment

Previous Post Next Post