二次改版
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user