예제 #1
0
 public function waitingPaymentDetail($id)
 {
     // $payment=Payment::where('id',$id)->first();
     $payment = Payment::find($id);
     $checkOuts = CheckOut::where('supplier_id', Auth::user()->id)->where('payment_id', $id)->get();
     $sampleOut = CheckOut::where('supplier_id', Auth::user()->id)->where('payment_id', $id)->first();
     $customer = Customer::where('id', $sampleOut->customer_id)->first();
     $paymentInfo = PaymentInfo::where('id', $payment->payment_info_id)->first();
     return view('dashboard.waitingPaymentDetail', ['customer' => $customer, 'checkOuts' => $checkOuts, 'payment' => $payment, 'paymentInfo' => $paymentInfo]);
 }
예제 #2
0
 public function showOrderDetail($id)
 {
     $user = Auth::user();
     $supplier = Supplier::where(['id' => $id])->first();
     $orders = $user->userable->checkOuts()->where(['supplier_id' => $id, 'payment_id' => null])->get();
     $paymentInfos = PaymentInfo::where(['supplier_id' => $id])->get();
     return view('dashboard.customer.orderDetail', ['orders' => $orders, 'supplier' => $supplier, 'paymentInfos' => $paymentInfos]);
 }
예제 #3
0
 /**
  * Update the specified resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function update(Request $request, $id)
 {
     if (!PaymentInfo::find($id)) {
         // return view('dashboard.supplierProfileEdit');
         return redirect()->back()->withErrors(['messages' => "Ödeme bilgisi bulunamadı"]);
     }
     $paymentInfo = PaymentInfo::find($id);
     if (Auth::user()->id != $paymentInfo->supplier_id) {
         //return view('dashboard.supplierProfileEdit');
         return redirect()->back()->withErrors(['messages' => "Ödeme bilgisi size ait değil"]);
     }
     $paymentInfoRules = array('title' => 'required', 'detail' => 'required');
     // do the validation ----------------------------------
     // validate against the inputs from our form
     $validator = Validator::make($request->all(), $paymentInfoRules);
     // check if the validator failed -----------------------
     if ($validator->fails()) {
         // get the error messages from the validator
         $updateProduct = $validator->messages();
         // redirect our user back to the form with the errors from the validator
         // return view('dashboard.supplierProfileEdit');
         return back()->withInput()->withErrors($validator);
     } else {
         $user = Auth::user();
         $paymentInfo->supplier_id = $user->id;
         $paymentInfo->title = $request->input('title');
         $paymentInfo->detail = $request->input('detail');
         $paymentInfo->update();
         return redirect()->back()->with('success', ['Ödeme bilgileriniz güncellendi']);
     }
 }