调整野蛮
This commit is contained in:
@@ -15,14 +15,21 @@ class ArticleController extends Controller
|
||||
*/
|
||||
public function show(Article $article)
|
||||
{
|
||||
// $parent = $category = $article->category;
|
||||
// $parent = $category = $article->category;
|
||||
// if ($category->childrens->isEmpty()) {
|
||||
// $parent = $category->parent;
|
||||
// }
|
||||
// $advert = Advert::where('category_id',73)->first();
|
||||
$categories = $article->categories;
|
||||
$parent = [];
|
||||
|
||||
return view('article.show', compact('article'));
|
||||
// return view('article.show', compact('article', 'parent', 'category','advert'));
|
||||
foreach ($categories as $category) {
|
||||
$top = getTopCate($category->id);
|
||||
$parent[] = $top->id;
|
||||
}
|
||||
|
||||
return view('article.show', compact('article', 'parent'));
|
||||
// return view('article.show', compact('article', 'parent', 'category','advert'));
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -20,10 +20,9 @@ class IndexController extends Controller
|
||||
//研究中心
|
||||
$links = Link::get();
|
||||
|
||||
$adverts = Advert::where('category_id', 72)->latest('sort')->get();
|
||||
$lt_adverts = Advert::where('category_id', 175)->latest('sort')->get();
|
||||
|
||||
return view('index.index', compact('links', 'adverts', 'lt_adverts'));
|
||||
return view('index.index', compact('links', 'lt_adverts'));
|
||||
}
|
||||
|
||||
//通用获取文章
|
||||
|
||||
@@ -22,7 +22,8 @@ class TestController extends Controller
|
||||
|
||||
public function set_article_category()
|
||||
{
|
||||
$articles = Article::whereHas('category')
|
||||
$articles = Article::query()
|
||||
->whereHas('category')
|
||||
->chunk(200, function ($articles) {
|
||||
foreach ($articles as $article) {
|
||||
ArticleCategory::create([
|
||||
|
||||
Reference in New Issue
Block a user