/** * 添加文章 * * @param Request $request * @author yangyifan <*****@*****.**> */ public function postAdd(SearchRequest $request) { //写入数据 $affected_number = SearchModel::create($request->all()); return $affected_number->id > 0 ? $this->response(200, trans('response.add_success'), [], true, url('admin/search/index')) : $this->response(400, trans('response.add_error'), [], false); }
/** * 删除数据 * * @param $id * @throws \Exception * @author yangyifan <*****@*****.**> */ public function getDelete($id) { SearchModel::del($id) > 0 ? $this->response(200, trans('response.delete_success'), [], false, url('admin/news/index')) : $this->response(400, trans('response.delete_error'), [], false); }