初步完成
This commit is contained in:
@@ -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'));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user