This commit is contained in:
2022-07-04 16:09:41 +08:00
parent 35b7fbc9fa
commit 8c28733e02
2 changed files with 11 additions and 11 deletions

View File

@@ -24,54 +24,54 @@ class IndexController extends Controller
$dzjsCate = Category::find(28);//党政建设 $dzjsCate = Category::find(28);//党政建设
$xxydCate = Category::find(9);//学习园地 $xxydCate = Category::find(9);//学习园地
$notices = Article::query() $notices = Article::shown()
->ByCategory(6) ->ByCategory(6)
->bysort() ->bysort()
->take(2) ->take(2)
->get();//两个通知公告 ->get();//两个通知公告
$mtbdArticles = Article::query() $mtbdArticles = Article::shown()
->byCategory(31) ->byCategory(31)
->bysort() ->bysort()
->take(2) ->take(2)
->get(); ->get();
$nyydtimg = Article::query() $nyydtimg = Article::shown()
->byCategory(7) ->byCategory(7)
->whereNotNull('cover') ->whereNotNull('cover')
->bysort() ->bysort()
->take(2) ->take(2)
->get(); ->get();
$nyydt = Article::query() $nyydt = Article::shown()
->whereNotIn('id', $nyydtimg->pluck('id')) ->whereNotIn('id', $nyydtimg->pluck('id'))
->byCategory(7) ->byCategory(7)
->bysort() ->bysort()
->take(4) ->take(4)
->get(); ->get();
$dzjsimg = Article::query() $dzjsimg = Article::shown()
->byCategory($dzjsCate->id) ->byCategory($dzjsCate->id)
->whereNotNull('cover') ->whereNotNull('cover')
->bysort() ->bysort()
->first(); ->first();
$dzjsArticles = Article::query() $dzjsArticles = Article::shown()
->where('id', '<>', $dzjsimg->id) ->where('id', '<>', $dzjsimg->id)
->byCategory($dzjsCate->id) ->byCategory($dzjsCate->id)
->bysort() ->bysort()
->take(6) ->take(6)
->get(); ->get();
$xxydimg = Article::query() $xxydimg = Article::shown()
->byCategory($xxydCate->id) ->byCategory($xxydCate->id)
->whereNotNull('cover') ->whereNotNull('cover')
->bysort() ->bysort()
->first(); ->first();
$xxydArticles = Article::query() $xxydArticles = Article::shown()
->where('id', '<>', $xxydimg->id) ->where('id', '<>', $xxydimg->id)
->byCategory($xxydCate->id) ->byCategory($xxydCate->id)
->bysort() ->bysort()
@@ -82,13 +82,13 @@ class IndexController extends Controller
$categorys = Category::oldest('order')->find([20, 21, 24]);//成果 $categorys = Category::oldest('order')->find([20, 21, 24]);//成果
$categorys = $categorys->map(function ($info) { $categorys = $categorys->map(function ($info) {
$imgArticle = Article::query() $imgArticle = Article::shown()
->byCategory($info->id) ->byCategory($info->id)
->whereNotNull('cover') ->whereNotNull('cover')
->bysort() ->bysort()
->first(); ->first();
$info->imgArticle = $imgArticle; $info->imgArticle = $imgArticle;
$info->articleLists = Article::query() $info->articleLists = Article::shown()
->where('id', '<>', $imgArticle->id) ->where('id', '<>', $imgArticle->id)
->byCategory($info->id) ->byCategory($info->id)
->bysort() ->bysort()