调整首页和分类页的院所新闻
This commit is contained in:
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace App\Http\Controllers;
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
use App\Models\Article;
|
||||||
use App\Models\Category;
|
use App\Models\Category;
|
||||||
|
|
||||||
class CategoryController extends Controller
|
class CategoryController extends Controller
|
||||||
@@ -36,13 +37,22 @@ class CategoryController extends Controller
|
|||||||
$template = 'photos';
|
$template = 'photos';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//院所新闻
|
||||||
|
if ($category->id == 66) {
|
||||||
|
$articles = Article::ByCategory([66, 67, 60, 61, 17, 26,])
|
||||||
|
->where('status', 1)
|
||||||
|
->latest('sort')
|
||||||
|
->latest('created_at')
|
||||||
|
->paginate();
|
||||||
|
|
||||||
|
} else {
|
||||||
$articles = $category->relations($category->type)
|
$articles = $category->relations($category->type)
|
||||||
->where('status', 1)
|
->where('status', 1)
|
||||||
->latest('sort')
|
->latest('sort')
|
||||||
->latest('created_at')
|
->latest('created_at')
|
||||||
->paginate();
|
->paginate();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
$parent = $category;
|
$parent = $category;
|
||||||
if ($category->childrens->isEmpty() && $category->parent) {
|
if ($category->childrens->isEmpty() && $category->parent) {
|
||||||
|
|||||||
@@ -13,16 +13,20 @@ class IndexController extends Controller
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Notes: 首页
|
* Notes: 首页
|
||||||
|
*
|
||||||
* @Author: 玄尘
|
* @Author: 玄尘
|
||||||
* @Date : 2020/6/1 9:11
|
* @Date : 2020/6/1 9:11
|
||||||
*/
|
*/
|
||||||
public function index()
|
public function index()
|
||||||
{
|
{
|
||||||
|
$ysxw = Article::where('status', 1)
|
||||||
|
->ByCategory([66, 67, 60, 61, 17, 26,])
|
||||||
|
->latest('sort')
|
||||||
|
->latest()
|
||||||
|
->take(7)
|
||||||
|
->get();
|
||||||
|
|
||||||
$top_adverts = Advert::where('category_id', 33)->latest('sort')->first();
|
return view('index.index', compact('ysxw'));
|
||||||
$cent_adverts = Advert::where('category_id', 33)->latest('sort')->first();
|
|
||||||
|
|
||||||
return view('index.index', compact('top_adverts', 'top_adverts'));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function search(Request $request)
|
public function search(Request $request)
|
||||||
|
|||||||
@@ -33,11 +33,11 @@
|
|||||||
<div id="myTabContent" class="tab-content publicContent">
|
<div id="myTabContent" class="tab-content publicContent">
|
||||||
<div role="tabpanel" class="tab-pane fade active in" id="publicTab01">
|
<div role="tabpanel" class="tab-pane fade active in" id="publicTab01">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
@if (getArticlesBYCate(66,7)->isNotEmpty())
|
@if ($ysxw->isNotEmpty())
|
||||||
<div class="col-md-6 col-xs-12">
|
<div class="col-md-6 col-xs-12">
|
||||||
<div class="swiper-container indexBig">
|
<div class="swiper-container indexBig">
|
||||||
<div class="swiper-wrapper">
|
<div class="swiper-wrapper">
|
||||||
@foreach (getArticlesBYCate(66,5) as $info)
|
@foreach ($ysxw as $info)
|
||||||
<div class="swiper-slide">
|
<div class="swiper-slide">
|
||||||
<div class="indexNew-img ce-img">
|
<div class="indexNew-img ce-img">
|
||||||
<span style="background-image: url({{ $info->cover_url}});"></span>
|
<span style="background-image: url({{ $info->cover_url}});"></span>
|
||||||
@@ -54,7 +54,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="col-md-6 col-xs-12">
|
<div class="col-md-6 col-xs-12">
|
||||||
<ul class="indexNew-list">
|
<ul class="indexNew-list">
|
||||||
@foreach (getArticlesBYCate(66,7) as $info)
|
@foreach ($ysxw as $info)
|
||||||
<li data-href="{{ $info->link }}">
|
<li data-href="{{ $info->link }}">
|
||||||
<div class="publicHover indexNew-name">
|
<div class="publicHover indexNew-name">
|
||||||
<span class="ce-nowrap">{{ $info->title }}</span>{{ $info->created_at->toDateString() }}
|
<span class="ce-nowrap">{{ $info->title }}</span>{{ $info->created_at->toDateString() }}
|
||||||
|
|||||||
Reference in New Issue
Block a user