阶段更新

This commit is contained in:
2022-06-30 10:34:16 +08:00
parent 619e493b0e
commit 2ef7d3786d
8 changed files with 111 additions and 71 deletions

View File

@@ -34,7 +34,7 @@ class CategoryController extends Controller
$parent = $category->parent;
}
$articles = Article::ByCategory($category->getAllChildrenId())
$articles = Article::shown()->ByCategory($category->getAllChildrenId())
->where('status', 1)
->Bysort()
->paginate();
@@ -47,7 +47,7 @@ class CategoryController extends Controller
];
if ($category->id == 2) {
$article = Article::query()->ByCategory(2)->Bysort()->first();
$article = Article::shown()->ByCategory(2)->Bysort()->first();
$data = array_merge($data, [
'article' => $article,
]);
@@ -57,9 +57,9 @@ class CategoryController extends Controller
$cgCate = Category::find(24);
$hjCate = Category::find(20);
$zlCate = Category::find(21);
$cgArticles = Article::query()->ByCategory($cgCate->id)->Bysort()->take(3)->get();
$hjArticles = Article::query()->ByCategory($hjCate->id)->Bysort()->take(3)->get();
$zlArticles = Article::query()->ByCategory($zlCate->id)->Bysort()->take(6)->get();
$cgArticles = Article::shown()->ByCategory($cgCate->id)->Bysort()->take(3)->get();
$hjArticles = Article::shown()->ByCategory($hjCate->id)->Bysort()->take(3)->get();
$zlArticles = Article::shown()->ByCategory($zlCate->id)->Bysort()->take(6)->get();
$data = array_merge($data, [
'cgCate' => $cgCate,
@@ -72,7 +72,7 @@ class CategoryController extends Controller
}
if ($category->id == 3) {
$articles = Article::ByCategory($category->getAllChildrenId())
$articles = Article::shown()->ByCategory($category->getAllChildrenId())
->where('status', 1)
->Bysort()
->get();
@@ -87,9 +87,9 @@ class CategoryController extends Controller
$nyydtCate = Category::find(7);
$mtbdCate = Category::find(31);
$tzArticles = Article::query()->ByCategory($tzCate->id)->Bysort()->take(4)->get();
$nyydtArticles = Article::query()->ByCategory($nyydtCate->id)->Bysort()->take(3)->get();
$mtbdArticles = Article::query()->ByCategory($mtbdCate->id)->Bysort()->take(3)->get();
$tzArticles = Article::shown()->ByCategory($tzCate->id)->Bysort()->take(4)->get();
$nyydtArticles = Article::shown()->ByCategory($nyydtCate->id)->Bysort()->take(3)->get();
$mtbdArticles = Article::shown()->ByCategory($mtbdCate->id)->Bysort()->take(3)->get();
$data = array_merge($data, [
'tzCate' => $tzCate,
'nyydtCate' => $nyydtCate,
@@ -105,8 +105,8 @@ class CategoryController extends Controller
$zdCate = Category::find(16);
$ljCate = Category::find(29);
$yjArticles = Article::query()->ByCategory($yjCate->id)->Bysort()->take(3)->get();
$ljLeaders = Leader::query()->where('category_id', $ljCate->id)->Bysort()->take(3)->get();
$yjArticles = Article::shown()->ByCategory($yjCate->id)->Bysort()->take(3)->get();
$ljLeaders = Leader::shown()->where('category_id', $ljCate->id)->Bysort()->take(3)->get();
$data = array_merge($data, [
'yjCate' => $yjCate,
'zdCate' => $zdCate,
@@ -118,9 +118,14 @@ class CategoryController extends Controller
if ($category->id == 32) {
$nghjxhArticle = Article::query()->ByCategory($category->id)->Bysort()->first();
$data = array_merge($data, [
$nghjxhArticle = Article::shown()->ByCategory($category->id)->Bysort()->first();
$xhdtCate = Category::find(33);
$xhdtArticles = Article::shown()->ByCategory($xhdtCate->id)->Bysort()->get();
$data = array_merge($data, [
'nghjxhArticle' => $nghjxhArticle,
'xhdtCate' => $xhdtCate,
'xhdtArticles' => $xhdtArticles,
]);
}

View File

@@ -22,7 +22,7 @@ class StaffController extends Controller
$parent = $category->parent;
}
$staffs = Staff::query()->latest('order')->get();
$staffs = Staff::shown()->latest('order')->get();
$data = [
'staffs' => $staffs,