/**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy($id, $history)
 {
     $history = PaymentHistory::findOrFail($history);
     $customer_id = $history->customer_id;
     if ($customer_id) {
         CustomerBooking::where('booking_id', $id)->where('customer_id', $history->customer_id)->update(['payed' => 0, 'payed_at' => '0000-00-00 00:00:00']);
     }
     $history->delete();
     return response()->json(['status' => 'ok', 'remove' => $customer_id]);
 }
 public function patchCustomerPayed(Request $request, $id, $customer)
 {
     CustomerBooking::where('booking_id', $id)->where('customer_id', $customer)->update(['payed' => 1, 'payed_at' => Carbon::now()]);
     return response()->json(['customer' => $customer]);
 }