type == Category::TYPE_SHOW) { if ($category->relations) { return redirect(route('article.show', $category->relations)); } } $parent = getTopCate($category->id); $template = array_flip(config('haai.category')); if (isset($template[$category->id]) && !in_array($category->id, config('haai.no_list'))) { return view('category.' . $template[$category->id], compact('category', 'parent')); } return redirect(route('category.list', $category)); } //显示文章列表 public function list(Category $category) { $take = 15; $template = 'category.list'; if (in_array($category->id, [29, 30])) { $take = 16; $template = 'category.persons'; } $articles = Article::where('category_id', $category->id) ->where('status', 1) ->latest('sort') ->latest() ->paginate($take); $parent = getTopCate($category->id); if (in_array($category->id, [55, 54]) && $category->children->isEmpty()) { $parent = $category->parent; } return view($template, compact('category', 'parent', 'articles')); } }