初步完成

This commit is contained in:
2021-03-25 16:05:06 +08:00
parent ae1ba1d4e9
commit 9d041184ea
124 changed files with 4358 additions and 4034 deletions

View File

@@ -18,15 +18,23 @@ class CategoryController extends Controller
if ($category->type == Category::TYPE_SHOW && $category->article_id) {
return redirect("articles/" . $category->article_id);
} else {
$articles = $category->relations(Category::TYPE_ARTICLE)->where('status', 1)->latest()->paginate(8);
$parent = $category;
$template = 'show';
if ($category->template) {
$template = $category->template;
}
$articles = $category->relations(Category::TYPE_ARTICLE)
->where('status', 1)
->latest()
->paginate(8);
$parent = $category;
if ($category->childrens->isEmpty() && $category->parent) {
$parent = $category->parent;
}
$advert = Advert::where('category_id', 73)->first();
return view('category.show', compact('articles', 'category', 'parent', 'advert'));
return view('category.' . $template, compact('articles', 'category', 'parent', 'advert'));
}
}