Method not allowed when delete record in laravel

Posted 4 months ago by sanjayacloud

Hello Friends,

I have got some error "Method not allowed " when delete record. My Delete method like this,

 public function destroy(Request $request, $id)
    {
        $data = Product::findOrFail($id);
        $data->delete();
        return redirect('/product/index');
    }

And my for like below,

<form action=""{{url('product/destroy/'.$row->id)}} method="post">
          @csrf
     <button type="submit" class="btn btn-outline-danger btn-block">Delete</button>
</form>

My route like this,

   Route::post('/product/destroy/{id}','[email protected]');

Any one have any idea about this error?

Please sign in or create an account to participate in this conversation.