コード例 #1
0
 public function index($sort = 'departure')
 {
     $this->page->title = 'Заказы такси';
     $this->page->desc = 'Текущие заказы';
     $this->data['sort'] = $sort;
     if (Sentinel::inRole('admin')) {
         // АДМИНИСТРАТОР Новые и редактированные заказы
         $this->data['orders_new'] = Order::whereIn('order_status', array(1, 2))->orderBy('updated_at', 'desc')->get();
         // АДМИНИСТРАТОР Текущие заказы
         if ($sort == 'arrivals') {
             // Сортировка по прилету
             $this->data['orders'] = Order::whereRaw('order_status = 3 AND (departure_time > now() OR arrivals_time > now())')->orderBy('arrivals_time')->get();
         } else {
             // Сортировка по вылету
             $this->data['orders'] = Order::whereRaw('order_status = 3 AND (departure_time > now() OR arrivals_time > now())')->orderBy('departure_time')->get();
         }
         // не олачено
         $this->data['nopay_orders'] = Order::whereRaw('order_status = 3 AND payment_status = 0 AND (departure_time < now() and arrivals_time < now())')->orderBy('departure_time')->get();
         $news = News::all();
         //            \Session::flash('messages', count($news));
         foreach ($news as $key => $val) {
             \Session::flash('flash_message_' . $key, $val->body);
         }
         // АДМИНИСТРАТОР отображение
         return $this->render('order.list-admin');
     } else {
         // ПОЛЬЗОВАТЕЛЬ Текущие заказы
         $this->data['orders'] = Order::whereRaw('user_id = ' . $this->user->id . ' AND (departure_time > now() OR arrivals_time > now())')->orderBy('created_at', 'DESC')->get();
         // не олачено
         $this->data['nopay_orders'] = Order::whereRaw('user_id = ' . $this->user->id . ' AND payment_status = 0 AND (departure_time < now() AND arrivals_time < now())')->orderBy('created_at', 'DESC')->get();
         $news = News::all();
         //            \Session::flash('messages', count($news));
         foreach ($news as $key => $val) {
             \Session::flash('flash_message_' . $key, $val->body);
         }
         // ПОЛЬЗОВАТЕЛЬ отображение
         return $this->render('order.list-user');
     }
 }
コード例 #2
0
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     $me = \Auth::user()->load('clients');
     $clients = $me->clients->pluck('id');
     return \App\Order::whereIn('client_id', $clients)->whereNull('waiter_id')->orderBy('id', 'desc')->get()->load('client', 'items.food');
 }
コード例 #3
0
ファイル: PagesController.php プロジェクト: axicraw/tropara
 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'));
 }