mercredi 2 juin 2021

Laravel not accepting POST Method

I been trying to add a route to my button, whereby I have declared the method to POST, but when I click on the button, an error prompt saying it is using GET method.

enter image description here

Here is my view

<form method="post" action="">
..
..
<table class="table m-l-sm">
                            <tbody>
                                @foreach($order->packages as $item)
                                
                                <tr>
                                    <td>
                                        <p class="m-b-xxs font-bold"></p>
                                        @foreach($item->products as $product)
                                        <p class="m-b-xxs"> X </p>
                                        @endforeach

                                        <div class="form-group row m-t-sm">
                                            <div class="col-md-4">
                                                <div class="input-group d-inline">
                                                    <span class="input-group-addon font-bold">RM </span>
                                                    <span class="input-group-addon">X</span>
                                                    <input id="" type="number" class="form-control" name="package[][qty]" value="" min="0" placeholder="Qty" @cannot('edit-order-package', $order) disabled @endcannot>                                                    
                                                </div>
                                            </div>@error('package.'.$item->id)
                                            <div class="col-md-12 alert alert-danger"></div>
                                            @enderror
                                                <div class="col-md-8 d-flex justify-content-end">
                                                    <a class="btn btn-sm btn-danger btn-danger" href="" >Delete</a>  <--- where i am calling my route
                                                </div>
                                        </div>
                                    </td>
                                </tr>
                                @endforeach
                            </tbody>
                        </table>
</form>

Here is my Route

  Route::post('/{order}/edit/delete', 'App\OrderController@handleDeleteItemOrder')->name('admin.order.item.edit.delete');

Controller

public function handleDeleteItemOrder(Order $order){
            log:info($order);
        }


from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2SMTFNE
via IFTTT

Aucun commentaire:

Enregistrer un commentaire