/** * 增加文章 * * @auther yangyifan <*****@*****.**> */ public function getAdd() { return $this->html_builder->builderTitle('增加文章')->builderFormSchema('title', '文章标题', $type = 'text', $default = '', $notice = '', $class = '', $rule = '*', $err_message = '', $option = '', $option_value_schema = '')->builderFormSchema('article_cat_id', '所属分类', 'select', $default = '', $notice = '', $class = '', $rule = '*', $err_message = '', ArticleCatModel::getAllForSchemaOption('cat_name'), 'cat_name')->builderFormSchema('keywords', '关键字')->builderFormSchema('description', '描述', 'textarea')->builderFormSchema('contents', '内容', 'ueditor')->builderFormSchema('thumb', '缩略图', 'image')->builderFormSchema('sort', '排序', 'text', 255)->builderFormSchema('status', '状态', 'radio', '', '', '', '', '', [1 => '开启', '2' => '关闭'], '1')->builderFormSchema('view', '点击量', 'text', mt_rand(100, 200))->builderConfirmBotton('确认', url('admin/article/add'), 'btn btn-success')->builderAdd(); }
/** * 处理新增文章分类 * * @auther yangyifan <*****@*****.**> */ public function postAdd(ArticleCatRequest $request) { $affected_number = ArticleCatModel::create($request->all()); return $affected_number->id > 0 ? $this->response(200, trans('response.add_success'), [], true, url('admin/article-cat/index')) : $this->response(400, trans('response.add_error'), [], true, url('admin/article-cat/index')); }