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