public function getList($date)
 {
     $limit = 12;
     if ($date == 'today') {
         $datename = "Bu <u>gün</u>e ait olan";
         $list = Order::orderBy('id', 'desc')->where('status', 1)->where('days', date('Y-m-d'))->paginate($limit);
     } else {
         if ($date == 'month') {
             $datename = "Bu <u>ay</u>a ait olan";
             $list = Order::orderBy('id', 'desc')->where('status', 1)->where('months', date('Y-m'))->paginate($limit);
         } else {
             if ($date == 'year') {
                 $datename = "Bu <u>yıl</u>a ait olan";
                 $list = Order::orderBy('id', 'desc')->where('status', 1)->where('years', date('Y'))->paginate($limit);
             } else {
                 $datename = "Tüm";
                 $list = Order::orderBy('id', 'desc')->where('status', 1)->paginate($limit);
             }
         }
     }
     $order_years = Order::where('years', date('Y'))->get();
     $order_months = Order::where('months', date('Y-m'))->get();
     $order_days = Order::where('days', date('Y-m-d'))->get();
     $order_all = Order::all();
     return View::make('order.list', compact('list', 'order_years', 'order_months', 'order_days', 'order_all'))->with(['title' => 'Siparişler', 'count_static' => true, 'date_visible' => true, 'price_all' => 0, 'datetime' => $date, 'datename' => $datename]);
 }
 public function searchOrder()
 {
     Log::debug('Entering AdminController::searchOrder() method... GET array: ' . print_r($_GET, TRUE));
     $searchCriteria = trim(urldecode(Input::get('search_order')));
     if (strlen($searchCriteria) > 2) {
         $orders = array();
         $criteria = array_map("trim", explode(',', $searchCriteria));
         $query = Order::orderBy('id', 'ASC');
         foreach ($criteria as $key => $value) {
             $query->orWhere('id', '=', $value);
         }
         $orders = $query->remember(5)->get();
         Log::debug('Order search results: ' . print_r($orders, TRUE));
         if (count($orders) == 1) {
             return Redirect::route('orders.show', $orders[0]->id);
         } elseif (count($orders) > 1) {
             $this->layout->content = View::make('admin.orders', compact('orders'));
         } else {
             return Redirect::back()->with('message', 'No <em><strong>orders</strong></em> found for search criteria: "' . $searchCriteria . '".');
         }
     } else {
         return Redirect::back()->with('message', 'Insufficent search criteria.');
     }
 }
 /**
  *  This function responses to
  *  the get request of /admin/employee/details/{id}
  *  and view employee respect to id
  */
 public function getDetails($id, $msg = null)
 {
     $employee = Employee::find($id);
     $employee->DOB = DateFormat::show($employee->DOB);
     if (!empty($msg) && $msg == 1) {
         return View::make('adminArea.employee.details')->with('employee', $employee)->with('orders', Order::orderBy('from', 'desc')->get())->with('success', "Order has been deactivated successfully");
     }
     return View::make('adminArea.employee.details')->with('employee', $employee)->with('orders', Order::orderBy('from', 'desc')->get());
 }
 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.";
     }
 }
 /**
  *  This function responses to
  *  the get request of /admin/movie/details/{id}
  *  and view movie respect to id
  */
 public function getDetails($id, $msg = null)
 {
     $movie = Movie::find($id);
     if (!empty($msg) && $msg == 1) {
         return View::make('adminArea.movie.details')->with('movie', $movie)->with('orders', Order::orderBy('from', 'desc')->get())->with('success', "Order has been deactivated successfully");
     }
     return View::make('adminArea.movie.details')->with('movie', $movie)->with('orders', Order::orderBy('from', 'desc')->get());
 }
 /**
  *  This function responses to
  *  the get request of /admin/order/active
  *  and show all active order as list
  */
 public function getAllActiveOrder($msg = null)
 {
     if (!empty($msg) && $msg == 1) {
         return View::make('adminArea.order.active')->with('orders', Order::orderBy('id', 'desc')->get())->with('success', 'Order has been deactivated successfully');
     }
 }
 /**
  * Display a listing of orders
  *
  * @return Response
  */
 public function index()
 {
     $orders = Order::orderBy('created_at', 'desc')->paginate(10);
     return View::make('admin.orders.index', compact('orders'));
 }
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     $orders = Order::orderBy('user_id')->get();
     return View::make("admin.order.list", array("orders" => $orders));
 }