/** * 删除数据 * * @param $id * @throws \Exception * @author yangyifan <*****@*****.**> */ public function getDelete($id) { QueryCatModel::del($id) > 0 ? $this->response(200, trans('response.delete_success'), [], false, url('admin/news/index')) : $this->response(400, trans('response.delete_error'), [], false); }
/** * 增加文章 * * @author yangyifan <*****@*****.**> */ public function getAdd() { return $this->html_builder->builderTitle('增加查询工具')->builderFormSchema('name', '查询工具名称')->builderFormSchema('query_cat_id', '所属分类', 'select', $default = '', $notice = '', $class = '', $rule = '*', $err_message = '', QueryCatModel::getAllForSchemaOption('cat_name'), 'cat_name')->builderFormSchema('site_url', '网址url', $type = 'text', $default = '', $notice = '', $class = '', $rule = 'url', $err_message = '', $option = '', $option_value_schema = '')->builderFormSchema('sort', '排序', 'text', 255)->builderFormSchema('status', '状态', 'radio', '', '', '', '', '', [1 => '开启', '2' => '关闭'], '1')->builderConfirmBotton('确认', url('admin/query/add'), 'btn btn-success')->builderAdd(); }
/** * 处理新增文章分类 * * @author yangyifan <*****@*****.**> */ public function postAdd(QueryCatRequest $request) { $affected_number = QueryCatModel::create($request->all()); return $affected_number->id > 0 ? $this->response(200, trans('response.add_success'), [], true, url('admin/query-cat/index')) : $this->response(400, trans('response.add_error'), [], true, url('admin/query-cat/index')); }