/** * 编辑帖子 * * @param Request $requests * @author yangyifan <*****@*****.**> */ public function postSave(Request $requests) { $data = $requests->only('id', 'forum_cat_id', 'contents', 'title'); $data['user_info_id'] = ForumModel::getUserId(); if (empty(ForumModel::getInfo((int) $data['id']))) { $this->response(400, trans('response.page_error')); } DB::table('forum')->where('id', '=', (int) $data['id'])->update(['title' => $data['title'], 'contents' => $data['contents'], 'forum_cat_id' => $data['forum_cat_id'], 'updated_at' => date('Y-m-d H:i:s')]); //跳转地址 $href = action('Home\\ForumController@getInfo', ['id' => $data['id']]); $this->response(200, trans('response.comment_forum_success'), $data = [], $target = true, $href); }