初步完成

This commit is contained in:
2020-09-11 10:27:23 +08:00
parent 9c6d4da51e
commit 49c3511dbe
43 changed files with 3437 additions and 1188 deletions

View File

@@ -2,20 +2,38 @@
namespace App\Http\Controllers;
use App\Models\Article;
use App\Models\Category;
class CategoryController extends Controller
{
/**
* Notes: 分类下的文章
* @Author: 玄尘
* @Date : 2020/6/1 9:19
* @param \App\Models\Category $category
*/
public function articles(Category $category)
//显示分类
public function show(Category $category)
{
if ($category->type == Category::TYPE_SHOW) {
if ($category->relations) {
return route('article.show', $category->relations);
}
}
$parent = getTopCate($category->id);
$template = array_flip(config('haai.category'));
if (isset($template[$category->id])) {
return view('category.' . $template[$category->id], compact('category', 'parent'));
}
return redirect(route('category.list', $category));
}
//显示文章列表
public function list(Category $category)
{
$articles = Article::where('category_id', $category->id)->where('status', 1)->paginate();
$parent = getTopCate($category->id);
return view('category.list', compact('category', 'parent', 'articles'));
}
}