/** * * 新增页面 * @return \Illuminate\View\View */ public function add() { $category = ShopSliderCategory::all(); return view("admin.slider.add", array("category" => $category)); }
/** *根据选择项显示不同的下拉选择项目 * @return \Illuminate\Http\JsonResponse * @throws DeepInException */ public function getItemIds() { $type = intval(\Input::get("type")); $checkVal = intval(\Input::get("check_val")); //对应的类型(1栏目 2专题类别 3slider) $data = array(); $data[1] = function () { //栏目 return ShopColumn::all(); }; $data[2] = function () { return ShopTopicCategory::all(); }; $data[3] = function () { return ShopSliderCategory::all(); }; if (!isset($data[$type])) { throw new DeepInException("错误的type" . $type); } return $this->successJSON(array("option" => $this->formatToOption($data[$type](), $checkVal))); }