public function show($id)
 {
     Article::whereNull('deleted_at')->findOrFail($id);
     $this->upView($id);
     $article = Article::find($id);
     $article->tag = explode(",", $article->tag);
     $article->last_reply = $article->comment->max('created_at');
     return view('user.article.show')->with('article', $article)->with('tops', ArticleController::getTop10());
 }
 public function index()
 {
     $user_id = \Auth::user()->id;
     $articles = Article::with('comment')->select(['id', 'title', 'tag', 'view', 'introduction', 'updated_at', 'created_at'])->where('user_id', $user_id)->where('status', config('DbStatus.article.status'))->paginate(1);
     foreach ($articles as $v) {
         $v->tag = str_replace(',', ',', $v->tag);
         $v->last_reply = $v->comment->max('created_at');
     }
     return view('user.user')->with('articles', $articles)->with('tops', ArticleController::getTop10());
 }
 public function cate($cate = null)
 {
     $cateId = DB::table('article_categories')->select('id')->where('title', $cate)->first();
     if (is_null($cateId)) {
         return $this->tagList();
     }
     if ($cate != null) {
         $articles = Article::with('comment')->select(['id', 'title', 'tag', 'view', 'introduction', 'updated_at', 'created_at'])->whereNull('deleted_at')->where('category_id', $cateId->id)->paginate(10);
     } else {
         return $this->tagList();
     }
     $list = array();
     foreach ($articles as $v) {
         $v->tag = str_replace(',', ',', $v->tag);
         $list = array_merge($list, explode(',', $v->tag));
         $v->last_reply = $v->comment->max('created_at');
     }
     $tags = array_unique($list);
     return view('home.cateList')->with('articles', $articles)->with('tags', $tags)->with('tops', ArticleController::getTop10());
 }