So I am experiencing a really strange problem. I am passing my parameters like this:
<form action="{{ route('deleteCustomerCartItem', ['product_id', $cartItem['product']->id, 'size' => $cartItem['size']]) }}" method="post">
I am printing the $cartItem['product']->id
inside my cart page and it prints the valid id. However when I pass it and var_dump
it, I get string(10) "product_id". I noticed that my route doesn't get the actual id but it gets 'product_id'. Here is my route:
Route::post('/cart/delete/{product_id}/{size?}', [
'uses' => 'CartController@deleteCustomerItem',
'as' => 'deleteCustomerCartItem']);
Here is the url I get from this route:
product_id must be 1 and S is the $cartItem['size']
. I don't know why this happens or why it gets '?1' at the end.
I need to get the value of product_id not the key. Can someone explain why this happens and how can I fix it?