文章关联多分类

This commit is contained in:
2021-04-02 10:35:51 +08:00
parent 28035e7a26
commit 96793afeec
20 changed files with 334 additions and 431 deletions

View File

@@ -10,18 +10,19 @@ class ArticleController extends Controller
/**
* 显示分类
* @param Category $category [description]
* @return [type] [description]
* @param \App\Models\Article $article
* @return \Illuminate\Contracts\Foundation\Application|\Illuminate\Contracts\View\Factory|\Illuminate\View\View [type] [description]
*/
public function show(Article $article)
{
$parent = $category = $article->category;
if ($category->childrens->isEmpty()) {
$parent = $category->parent;
}
$advert = Advert::where('category_id',73)->first();
// $parent = $category = $article->category;
// if ($category->childrens->isEmpty()) {
// $parent = $category->parent;
// }
// $advert = Advert::where('category_id',73)->first();
return view('article.show', compact('article', 'parent', 'category','advert'));
return view('article.show', compact('article'));
// return view('article.show', compact('article', 'parent', 'category','advert'));
}