Exemplo n.º 1
0
 /**
  * 用于客户端的帖子详细 Web View.
  *
  * @param $id
  *
  * @return \Illuminate\View\View
  */
 public function showWebView($id)
 {
     $topic = $this->topics->find($id, ['title', 'body', 'created_at', 'vote_count']);
     return view('api_web_views.topic', compact('topic'));
 }
Exemplo n.º 2
0
 /**
  * 反对帖子.
  *
  * @param $id
  *
  * @return \Illuminate\Http\Response
  */
 public function voteDown($id)
 {
     $topic = $this->repository->find($id);
     return response(['vote-down' => $this->repository->voteDown($topic), 'vote_count' => $topic->vote_count]);
 }