调整页面

This commit is contained in:
2020-09-15 14:01:28 +08:00
parent 3ac390f68f
commit f91a3b76c1
20 changed files with 5068 additions and 642 deletions

View File

@@ -10,7 +10,7 @@ class CategoryController extends Controller
/**
* 显示分类
* @param Category $category [description]
* @param Category $category [description]
* @return [type] [description]
*/
public function index(Category $category)
@@ -18,15 +18,15 @@ 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)->paginate();
$articles = $category->relations(Category::TYPE_ARTICLE)->paginate(2);
$parent = $category;
if ($category->childrens->isEmpty()) {
if ($parent->childrens->isEmpty()) {
$parent = $category->parent;
}
$advert = Advert::where('category_id',73)->first();
$advert = Advert::where('category_id', 73)->first();
return view('category.show', compact('articles', 'category', 'parent','advert'));
return view('category.show', compact('articles', 'category', 'parent'));
}
}