destination is not being added in Cart. Name , qty, price and id is passed and can be easily be accessed in the cart.index page , but the destination is not shown. Also tell me how can i pass the id="str" and id="rTotal" to cart.store page and show them in card.index page (These two variable are of javascript variables that contains some value). Can anyone help. Here is the code the i'm passing values of the product to the cart
<form action="{{route('cart.store')}}" method="post">
{{ csrf_field() }}
<input type="hidden" name="id" value="{{$product->id}}">
<input type="hidden" name="name" value="{{$product->name}}">
<input type="hidden" name="price" value="{{$product->price}}">
<input type="hidden" name="destination" value="{{$product->destination}}">
<input type="hidden" id="str" name="str" value="">
<input type="hidden" id="rTotal" name="rTotal" value="">
<button type="submit">click me</button>
</p>
</form>
This is the code of my cartController
public function store(Request $request) {
Cart::add(array('id' => $request->id, 'name' => $request->name, 'qty' => 1,
'price' => $request->price, 'destination' => $request->destination));
return redirect()->route('cart.index')->with('success_message','Item was added to your cart');
}
And here is the code of cart.index page that is showing all the other values except destination
<tbody>
@foreach(Cart::content() as $row)
<tr>
<td><a href="#"><img src="img/detailsquare.jpg" alt="White Blouse Armani" class="img-fluid"></a></td>
<td><a href="#">{{$row->id}}</a></td>
<td><a href="#">{{$row->name}}</a></td>
<td>{{$row->qty}}</td>
<td>{{$row->price}}</td>
<td>{{$row->destination}}</td>
<td><a href="#"><i class="fa fa-trash-o"></i></a></td>
</tr>
@endforeach
</tbody>