Exemplo n.º 1
0
 public function getSearchOrder(Request $request)
 {
     if (Auth::check()) {
         return $request;
         $orders = Order::searchOrder();
     } else {
         return ["result" => false, "msg" => "Session not found"];
     }
 }
Exemplo n.º 2
0
 public function getSearchOrders(Request $request)
 {
     if (Auth::check()) {
         $fabric_name = $request->input("fabricName");
         $status = $request->input("status");
         $type_sample = $request->input("type_sample");
         $date = $request->input("date");
         $type = $request->input("type") != null ? $request->input("type") : "null";
         if ($type == "all" && User::isAdmin(Auth::user())) {
             $orders = Order::searchOrder(-1, $fabric_name, $date, $status, $type_sample);
             return ["result" => true, "msg" => "Orders found", "orders" => $orders];
         }
         $orders = Order::searchOrder(Auth::user()->id, $fabric_name, $date, $status, $type_sample);
         return ["result" => true, "msg" => "Orders found", "orders" => $orders];
     } else {
         return ["result" => false, "msg" => "Session not found"];
     }
 }