/** * Update the specified resource in storage. * * @param \Illuminate\Http\Request $request * @param int $id * @return \Illuminate\Http\Response */ public function update($id) { $a = Booking::where('id', $id)->update(['verify' => 1]); $b = BookingDetail::where('bookingID', $id)->update(['verify' => 1]); if ($a <= 0 || $b <= 0) { return response()->json(['result' => false, 'message' => 'can not find this booking.']); } $temp_booking = ViewBookingAndDetail::where('active', 1)->where('id', $id)->groupBy('id')->orderBy('zoneNumber')->get(); foreach ($temp_booking as $key => $value) { $value->detail = BookingDetail::where('bookingID', $value->id)->get(); $value->user = User::where('id', $value->userID)->first(); } return response()->json(['result' => true, 'message' => 'success', 'data' => $temp_booking]); }