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.
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);
}
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire