public function show($id)
 {
     //abort(404);
     $contents = Topic::findOrFail($id);
     $vote = ['status' => ''];
     if (Auth::check()) {
         $vote = Recomment::user(Auth::user()->user_id)->topic($id)->first();
     }
     $comment = Comment::with('user')->comment($id)->get();
     $last_comment = Comment::with('user')->comment($id)->orderBy('created_at', 'desc')->first();
     return view('posts.show', compact('contents', 'vote', 'comment', 'last_comment'));
 }
 public function store()
 {
     $data = array();
     $validator = Validator::make(Request::except('_token'), Comment::$validatorComment);
     if ($validator->fails()) {
         flash()->error("操作失败");
         return redirect()->back();
     }
     $data['topic_id'] = Request::Input('topic_id');
     $data['subject'] = clean(Request::Input('subject'));
     $data['author'] = Auth::user()->username;
     $data['author_id'] = Auth::user()->user_id;
     $data['status'] = '1';
     if (Comment::create($data)) {
         flash()->success("评论成功");
     }
     return redirect()->back();
 }
 public function getAll()
 {
     return Comment::all();
 }
 public function find($id)
 {
     return Comment::find($id);
 }