type == Category::TYPE_LINK && $category->uri) { return redirect()->away($category->uri); } $topCate = $category->getTopCategory(); $template = 'list'; if ($category->template) { $template = $category->template; } $parent = $category; if ($category->children->isEmpty() && $category->parent) { $parent = $category->parent; } $pageNum = $this->pageNum; if ($category->template == 'list_image_title_des_date') { $pageNum = 6; } $articles = Article::shown()->ByCategory($category->getAllChildrenId()) ->where('status', 1) ->Bysort() ->paginate($pageNum); $data = [ 'articles' => $articles, 'category' => $category, 'parent' => $parent, 'topCate' => $topCate, ]; if ($category->id == 2) { $article = Article::shown()->ByCategory(2)->Bysort()->first(); $data = array_merge($data, [ 'article' => $article, ]); } if ($category->id == 18) { $cgCate = Category::find(24); $hjCate = Category::find(20); $zlCate = Category::find(21); $cgArticles = Article::shown()->ByCategory($cgCate->id)->Bysort()->take(3)->get(); $hjArticles = Article::shown()->ByCategory($hjCate->id)->Bysort()->take(3)->get(); $zlArticles = Article::shown()->ByCategory($zlCate->id)->Bysort()->take(6)->get(); $data = array_merge($data, [ 'cgCate' => $cgCate, 'hjCate' => $hjCate, 'zlCate' => $zlCate, 'cgArticles' => $cgArticles, 'hjArticles' => $hjArticles, 'zlArticles' => $zlArticles, ]); } if ($category->id == 3) { $articles = Article::shown()->ByCategory($category->getAllChildrenId()) ->where('status', 1) ->Bysort() ->get(); $data = array_merge($data, [ 'articles' => $articles, ]); } if ($category->id == 5) { $tzCate = Category::find(6); $nyydtCate = Category::find(7); $mtbdCate = Category::find(31); $tzArticles = Article::shown()->ByCategory($tzCate->id)->Bysort()->take(4)->get(); $nyydtArticles = Article::shown()->ByCategory($nyydtCate->id)->Bysort()->take(3)->get(); $mtbdArticles = Article::shown()->ByCategory($mtbdCate->id)->Bysort()->take(3)->get(); $data = array_merge($data, [ 'tzCate' => $tzCate, 'nyydtCate' => $nyydtCate, 'mtbdCate' => $mtbdCate, 'tzArticles' => $tzArticles, 'nyydtArticles' => $nyydtArticles, 'mtbdArticles' => $mtbdArticles, ]); } if ($category->id == 11) { $yjCate = Category::find(12); $zdCate = Category::find(16); $ljCate = Category::find(29); $yjArticles = Article::shown()->ByCategory($yjCate->id)->Bysort()->take(3)->get(); $ljLeaders = Leader::shown()->where('category_id', $ljCate->id)->Bysort()->take(3)->get(); $data = array_merge($data, [ 'yjCate' => $yjCate, 'zdCate' => $zdCate, 'ljCate' => $ljCate, 'yjArticles' => $yjArticles, 'ljLeaders' => $ljLeaders, ]); } if ($category->id == 32) { $nghjxhArticle = Article::shown()->ByCategory($category->id)->Bysort()->first(); $xhdtCate = Category::find(33); $xhdtArticles = Article::shown()->ByCategory($xhdtCate->id)->Bysort()->get(); $data = array_merge($data, [ 'nghjxhArticle' => $nghjxhArticle, 'xhdtCate' => $xhdtCate, 'xhdtArticles' => $xhdtArticles, ]); } return view('category.'.$template, $data); } }