Exemplo n.º 1
0
 public function submitPayment(Request $request)
 {
     $validator = Validator::make($request->all(), ['payment_option' => 'required|integer|exists:payment_infos,id']);
     if ($validator->fails()) {
         // get the error messages from the validator
         $messages = $validator->messages();
         // redirect our user back to the form with the errors from the validator
         return back()->withInput()->withErrors($messages);
     } else {
         $payment = new Payment();
         $payment->text = $request->input('note');
         $payment->payment_info_id = $request->input('payment_option');
         $payment->save();
         foreach ($request->input('checkouts') as $checkOutID) {
             $checkOut = CheckOut::where(['id' => $checkOutID, 'customer_id' => Auth::user()->id, 'payment_id' => null])->first();
             $checkOut->payment_id = $payment->id;
             $checkOut->update();
         }
         return redirect()->action('Dashboard\\CustomerController@showUnpaidOrders')->with(['success' => ['Odeme kaydı oluşturuldu']]);
     }
 }
Exemplo n.º 2
0
 public function confirmPayment(Request $request, $id)
 {
     $payment = Payment::find($id);
     $payment->does_supplier_confirm = 1;
     $payment->update();
     $checkouts = CheckOut::where(['supplier_id' => Auth::user()->id, 'payment_id' => $id])->get();
     foreach ($checkouts as $checkout) {
         $checkout->confirmed_by_supplier = 1;
         $checkout->update();
     }
     return redirect()->action('Dashboard\\SupplierController@showWaitingPayments')->with(['success' => ['Müşteri ödemesi onaylandı.']]);
 }