Beispiel #1
0
 public function viewreturn($id)
 {
     $return = Orderreturn::with('orders', 'user')->first();
     return view('admin.order.viewreturn', compact('return'));
 }
Beispiel #2
0
 public function processreturn(Request $request)
 {
     $this->validate($request, ['products' => 'required', 'name' => 'required', 'email' => 'required|email', 'mobile' => 'required|digits:10', 'address' => 'required', 'reason' => 'required']);
     $order_ids = $request->get('products');
     $orders = Order::whereIn('id', $order_ids)->get();
     $user = Sentinel::check();
     $user = User::findorfail($user->id);
     $return_inputs = ['user_id' => $user->id, 'name' => $request->get('name'), 'email' => $request->get('email'), 'mobile' => $request->get('mobile'), 'address' => $request->get('address'), 'area_id' => $user->area_id, 'reason' => $request->get('reason'), 'status' => 'Booked'];
     //dd($return_inputs);
     $return = Orderreturn::Create($return_inputs);
     if ($return) {
         $returns = [];
         foreach ($orders as $order) {
             array_push($returns, ['order_id' => $order->id, 'return_id' => $return->id]);
         }
         DB::table('order_return')->insert($returns);
     }
     $notification = "Sorry! We regret you did not like these products.These products you have selected has been registered for return. Our staff will reach to you and receive those products. Kindly dont not consume the product and make it ready for pickup. Thank you.";
     return view('site.notification', compact('notification'));
 }