public function complete(Request $request, $id){
$order = Order::find($id);
// Update the Order
$value = $request->input('table');
$number = DB::table('tables')->where('number' , '=' , $value)->update(['status' => "Fine"]);
$order->update(['status' => 'CompletedOrders']);
return redirect()->route('servedorders');
}
我给表输入赋值了一个变量。然后我尝试将这个变量与表中的列进行匹配。但我无法将值更新为“free”。我的询问有什么问题吗?
所有价值都来自何处。
@foreach($orders as $order)
@if($order->status == "OrdersServed")
<div class="panel panel-default">
<div class="panel-body">
<ul class="list-group" >
<li class="list-group-item" style="background-color: #467aeb">
<a href="{{route('showcompleteorder',$order->id)}}"><h1 style="color: #051942; font-family: Helvetica; font-weight: bold">Order# {{$order->id}}</h1></a>
<span class="label label-success"><p style="font-size: 15px; color: white">Name: <b>{{$order->name}}</b></p></span>
<span class="label label-success"><p style="font-size: 15px; color: white">Phone: <b>{{$order->phone}}</b></p></span>
@foreach($order->cart->items as $item)
<span class="label label-success"><p style="font-size: 15px; color: #051942"><b>{{$item['qty'] }} {{ $item['item']['name'] }} </b></p></span>
<span class="label label-success"><p style="font-size: 15px; color: #051942">Price: <b>₹{{ $item['price'] }}</b></p></span>
@endforeach
<span class="label label-success"><p style="font-size: 15px; color: white">Table: <b>{{$order->table}}</b></p></span>
<br>
<span class="badge" style="color: #051942; font-size: 16px">Order Time: {{$order->created_at}}</span>
<br>
@if($order->status == 'OrdersServed')
<a class="btn btn-block btn-info btn-flat" style="font-size: 20px" href="{{route('complete', $order->id)}}">Order Completed</a>
@endif
提前谢谢。
1条答案
按热度按时间ryevplcw1#
您的视图不包含
<input>
随信寄$request
至complete
功能,所以$request->input('table')
正在返回空值。但我能看见你的眼睛
order
不包含table
,您将发送订单id
到complete
函数,以便使用: