public function indentList() { $type = Input::get("type", "all"); $perPage = 15; if ($type == "untreated") { $indents = AgencyOrder::where("process_status", "=", "0")->orderBy("updated_at", "desc")->with("traffic_violation_info")->paginate($perPage); } else { if ($type == "treated") { $indents = AgencyOrder::where("process_status", "=", "1")->orderBy("updated_at", "desc")->with("traffic_violation_info")->paginate($perPage); } else { if ($type == "treating") { $indents = AgencyOrder::where("process_status", "=", "2")->orderBy("updated_at", "desc")->with("traffic_violation_info")->paginate($perPage); } else { if ($type == "finished") { $indents = AgencyOrder::where("process_status", "=", "3")->orderBy("updated_at", "desc")->with("traffic_violation_info")->paginate($perPage); } else { if ($type == "closed") { $indents = AgencyOrder::where("process_status", "=", "4")->orderBy("updated_at", "desc")->with("traffic_violation_info")->paginate($perPage); } else { $indents = AgencyOrder::orderBy("created_at", "desc")->with("traffic_violation_info")->paginate($perPage); } } } } } $indents->addQuery('type', $type); return View::make('pages.admin.business-center.indent-list', ["indents" => $indents, "count" => $indents->count(), "totalCount" => $indents->getTotal()]); }