二次改版

This commit is contained in:
2022-06-29 17:03:47 +08:00
parent 2288b76e4e
commit 619e493b0e
168 changed files with 4676 additions and 1759 deletions

View File

@@ -14,7 +14,22 @@ class ArticleController extends Controller
return redirect($article->url);
}
return view('articles.show', compact('article'));
$category = $article->categories()->first();
$parent = $category;
$topCate = $category->getTopCategory();
if ($category->childrens->isEmpty() && $category->parent) {
$parent = $category->parent;
}
$data = [
'article' => $article,
'category' => $category,
'parent' => $parent,
'topCate' => $topCate,
];
return view('articles.show', $data);
}
}