示例#1
0
 public function viewAllOrders()
 {
     $today = Carbon\Carbon::toDay()->toDateTimeString();
     if (Auth::user()->role == "admin" || Auth::user()->role == "cashier") {
         $orders_today = Order::where('created_at', '>=', Carbon\Carbon::now()->startOfDay())->orderBy('created_at', 'desc')->paginate(10);
         $orders_all = Order::orderBy('created_at', 'desc')->paginate(10);
         return View::make('order.list')->with(array('orders_today' => $orders_today, 'orders_all' => $orders_all));
     } else {
         echo "Access Denied. You have no permission to access this area.";
     }
 }