/**
  * 帖子详情
  *
  * @return \Illuminate\View\View
  * @author yangyifan <*****@*****.**>
  */
 public function getInfo(Request $request, $id)
 {
     //获得帖子内容
     $forum_info = ForumModel::getInfo($id);
     if (empty($forum_info)) {
         return redirect()->action('Home\\ForumController@getIndex');
     }
     return view('home.forum.info', ['user_profile' => ProfileModel::getUserProfile($forum_info->user_info_id), 'data' => $forum_info, 'title' => '论坛-' . $forum_info->title, 'keywords' => '论坛-' . $forum_info->title, 'description' => '论坛-' . $forum_info->title]);
 }
Ejemplo n.º 2
0
 /**
  * 编辑帖子
  *
  * @param Request $requests
  * @author yangyifan <*****@*****.**>
  */
 public function postSave(Request $requests, $id)
 {
     $data = $requests->only('id', 'forum_cat_id', 'contents', 'title');
     $data['user_info_id'] = Session::get('user_info.id');
     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')]);
     $this->response(200, 'success', $data = [], $target = true, $href = action('Home\\ForumController@getInfo', ['id' => $data['id']]));
 }