微调
This commit is contained in:
@@ -19,8 +19,8 @@ class CategoryController extends Controller
|
||||
$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'));
|
||||
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));
|
||||
@@ -39,17 +39,17 @@ class CategoryController extends Controller
|
||||
}
|
||||
|
||||
$cate_ids = Category::where('parent_id', $category->id)
|
||||
->orWhere('id', $category->id)
|
||||
->where('status', 1)
|
||||
->whereIn('type', [Category::TYPE_ARTICLE, Category::TYPE_SHOW])
|
||||
->pluck('id')
|
||||
->toArray();
|
||||
->orWhere('id', $category->id)
|
||||
->where('status', 1)
|
||||
->whereIn('type', [Category::TYPE_ARTICLE, Category::TYPE_SHOW])
|
||||
->pluck('id')
|
||||
->toArray();
|
||||
|
||||
$articles = Article::where('status', 1)
|
||||
->ByCategory($cate_ids)
|
||||
->latest('sort')
|
||||
->latest()
|
||||
->paginate($take);
|
||||
->ByCategory($cate_ids)
|
||||
->latest('sort')
|
||||
->latest()
|
||||
->paginate($take);
|
||||
|
||||
$parent = getTopCate($category->id);
|
||||
|
||||
@@ -57,6 +57,10 @@ class CategoryController extends Controller
|
||||
$parent = $category->parent;
|
||||
}
|
||||
|
||||
if ($category->children->isEmpty()) {
|
||||
$parent = $category->parent;
|
||||
}
|
||||
|
||||
return view($template, compact('category', 'parent', 'articles'));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user